/* =========================================================================
   Компактный мобильный дизайн — лёгкий, современный
   ========================================================================= */

:root {
  --bg: #f2f4f8;
  --card: #fff;
  --text: #1a1a2e;
  --muted: #8b8fa3;
  --primary: #3b5bdb;
  --primary-dark: #2f4bb5;
  --green: #2b8a3e;
  --amber: #d97706;
  --red: #e03131;
  --border: #eef0f4;
  --radius: 14px;
  --shadow: 0 2px 8px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font: 400 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 12px;
}

/* Кабинет пользователя — узкая версия */
.user-cabinet {
  max-width: 520px;
}

.user-cabinet .table th,
.user-cabinet .table td {
  font-size: .8rem;
  padding: 6px 6px;
}

.user-cabinet .table-wrap {
  margin: 0 -16px;
  padding: 0 16px;
}

/* -------------------------------------------------------------------------
   Шапка
   ------------------------------------------------------------------------- */

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: .9rem;
  font-weight: 700;
  color: var(--primary);
}

.topnav {
  display: flex;
  gap: 2px;
}

.topnav a {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
}

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

/* -------------------------------------------------------------------------
   Карточки — скруглённые, с тенью
   ------------------------------------------------------------------------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.card h2 {
  font-size: .95rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.card h3 {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.card h4 {
  font-size: .9rem;
  font-weight: 600;
  margin: 0 0 2px;
}

/* -------------------------------------------------------------------------
   Профиль пользователя — компактно
   ------------------------------------------------------------------------- */

.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

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

.profile-name {
  font-weight: 700;
  font-size: .95rem;
}

.profile-addr {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-detail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
}

/* -------------------------------------------------------------------------
   Блок дней — компактный
   ------------------------------------------------------------------------- */

.days-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.days-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1;
  color: #fff;
}

.days-circle span {
  font-size: .5rem;
  font-weight: 500;
  opacity: .85;
  margin-top: 1px;
}

.days-circle.green { background: var(--green); }
.days-circle.amber { background: var(--amber); }
.days-circle.red   { background: var(--red); }

.days-text {
  flex: 1;
  font-size: .82rem;
  color: var(--muted);
}

/* -------------------------------------------------------------------------
   Кнопки
   ------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all .15s;
}

.btn:hover {
  background: #e5e7ec;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-green {
  background: var(--green);
  color: #fff;
}

.btn-small {
  padding: 4px 12px;
  font-size: .78rem;
  border-radius: 16px;
}

.btn-big {
  padding: 12px 20px;
  font-size: .9rem;
  width: 100%;
  border-radius: 24px;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* -------------------------------------------------------------------------
   Telegram
   ------------------------------------------------------------------------- */

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

.tg-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: .85rem;
  background: var(--bg);
  min-width: 0;
}

.tg-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.tg-status {
  font-size: .78rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-sub {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 2px 0 10px;
}

.card-subtitle {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 8px;
}

.notice-list {
  margin: 0;
  padding-left: 18px;
  font-size: .84rem;
  line-height: 1.6;
  color: var(--text);
}

.notice-list li { margin-bottom: 2px; }

.back-row {
  display: flex;
  justify-content: flex-start;
  margin: 4px 0 14px;
}

.back-link {
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
}
.back-link:hover {
  color: var(--primary);
  text-decoration: none;
}

/* -------------------------------------------------------------------------
   Формы (вход, админка)
   ------------------------------------------------------------------------- */

.login-card {
  max-width: 320px;
  margin: 40px auto;
}

.form label,
.login-card label {
  display: block;
  margin-bottom: 10px;
  font-size: .82rem;
  color: var(--muted);
}

.form input[type="text"],
.form input[type="password"],
.form input[type="number"],
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: .9rem;
  margin-top: 4px;
  background: var(--bg);
  transition: all .15s;
}

.form input:focus,
.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: .85rem;
  font-family: inherit;
  background: var(--bg);
  resize: vertical;
}
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* -------------------------------------------------------------------------
   Таблицы
   ------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.table th, .table td {
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table th {
  font-weight: 600;
  color: var(--muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: 0;
}

.table tbody tr:active { background: var(--bg); }

.row-warn { background: #fffbeb !important; }
.row-dead { background: #fef2f2 !important; }

.actions {
  display: flex;
  gap: 3px;
  align-items: center;
}
.actions form { display: inline; }

/* -------------------------------------------------------------------------
   Бейджи
   ------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-admin { background: #dbeafe; color: #1e40af; }
.badge-gray  { background: #f1f5f9; color: #475569; }
.badge-warn  { background: #fef3c7; color: #92400e; }
.badge-ok    { background: #dcfce7; color: #166534; }
.badge-danger{ background: #fee2e2; color: #991b1b; }

/* -------------------------------------------------------------------------
   Админка
   ------------------------------------------------------------------------- */

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.admin-head h1 { margin: 0; font-size: 1rem; font-weight: 700; }

.admin-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Плитки статистики */
.stat-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.stat {
  flex: 1 1 0;
  min-width: 88px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 9px 12px;
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.15;
}

.stat-label {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  margin-top: 2px;
}

/* Карточка с таблицей — без обрезки, с горизонтальной прокруткой */
.card-scroll {
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card-scroll .table { min-width: 680px; }

/* Строка поиска */
.card-search { padding: 8px 10px; }
.card-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: .85rem;
  background: var(--bg);
  font-family: inherit;
}
.card-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.actions-center { justify-content: center; }

/* Показ/скрытие секрета (токен бота) */
.secret-row { display: flex; gap: 6px; align-items: stretch; }
.secret-row input { flex: 1; min-width: 0; }
.secret-row .btn { margin-top: 4px; }

.form-card { max-width: 720px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-grid label { margin-bottom: 0; }

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

.field-hint {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  margin-top: 3px;
}

.auto-days {
  background: #f3f6ff;
  border: 1.5px solid #dfe6ff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: .82rem;
  color: #2f4bb5;
  margin-bottom: 10px;
}

/* Созданные / сброшенные данные для входа */
.cred-card {
  background: #ecfdf5;
  border: 1.5px solid #b7ecd0;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  max-width: 720px;
}

.cred-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #166534;
  margin-bottom: 8px;
}

.cred-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.cred-label {
  width: 62px;
  flex-shrink: 0;
  font-size: .78rem;
  color: #166534;
}

.cred-value {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 1rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid #b7ecd0;
  border-radius: 8px;
  padding: 5px 10px;
  letter-spacing: .02em;
  overflow-x: auto;
  white-space: nowrap;
}

.cred-copy {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #b7ecd0;
  color: #166534;
}
.cred-copy:hover { background: #dcfce7; }

.cred-actions { margin-top: 10px; }

.cred-hint {
  margin: 8px 0 0;
  font-size: .74rem;
  color: #166534;
  opacity: .85;
  line-height: 1.45;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .72rem;
  white-space: nowrap;
}

.backup-table-wrap { overflow-x: auto; }
.backup-table-wrap .table th,
.backup-table-wrap .table td {
  padding: 7px 8px;
  font-size: .78rem;
}

/* Таймер заявки на оплату */
.pay-timer {
  margin-top: 4px;
  font-size: .78rem;
  font-weight: 600;
  color: #92400e;
}
.pay-timer strong { font-variant-numeric: tabular-nums; }

.pay-expired {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  font-size: .78rem;
  line-height: 1.4;
}

.btn:disabled,
.btn[disabled] {
  opacity: .6;
  cursor: not-allowed;
}

/* Отчёт по проверке прокси */
.proxy-report {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.proxy-report-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 6px;
}

.proxy-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: .78rem;
  padding: 3px 0;
  flex-wrap: wrap;
}

.proxy-name {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .74rem;
  word-break: break-all;
}

.proxy-info { color: var(--muted); font-size: .72rem; }
.proxy-ok { color: var(--green); }
.proxy-fail { color: var(--red); }

.news-title {
  font-size: .92rem;
  font-weight: 700;
  margin: 2px 0 3px;
}

/* -------------------------------------------------------------------------
   Новости
   ------------------------------------------------------------------------- */

.news-item {
  padding: 6px 0;
}
.news-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.news-meta {
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 2px;
}

.news-content {
  font-size: .85rem;
  line-height: 1.5;
  color: #444;
  white-space: pre-wrap;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  cursor: pointer;
}
.checkbox-label input { width: 16px; height: 16px; }

/* -------------------------------------------------------------------------
   Флеш
   ------------------------------------------------------------------------- */

.flash {
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: .82rem;
  font-weight: 500;
  transition: opacity .35s ease, transform .35s ease;
}
.flash-hide {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.flash-success { background: #dcfce7; color: #166534; }
.flash-error   { background: #fee2e2; color: #991b1b; }
.flash-info    { background: #dbeafe; color: #1e40af; }

/* -------------------------------------------------------------------------
   Login page
   ------------------------------------------------------------------------- */

.login-page {
  max-width: 400px;
  margin: 30px auto;
  text-align: center;
  padding: 20px;
}

.login-logo {
  margin-bottom: 12px;
}

.login-logo img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}

.login-sub {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 24px;
}

.login-form {
  text-align: left;
}

.login-field {
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.login-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: #f8faff;
  transition: all .15s;
  box-sizing: border-box;
}

.login-field input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59,91,219,.12);
}

.btn-login {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  border-radius: 12px;
  margin-top: 4px;
  font-weight: 600;
}

/* -------------------------------------------------------------------------
   Прочее
   ------------------------------------------------------------------------- */

.muted { color: var(--muted); font-size: .8rem; }

.requisites pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: .85rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/* -------------------------------------------------------------------------
   Разделители для списков
   ------------------------------------------------------------------------- */

.meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.meta-row strong {
  color: var(--text);
  font-weight: 600;
}

/* -------------------------------------------------------------------------
   Мобильная адаптация — экраны до 480px
   ------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .container { padding: 0 8px; }
  .card { padding: 12px 14px; border-radius: 12px; }
  .admin-toolbar .btn { flex: 1; text-align: center; }
  .tg-row .btn { padding: 8px 12px; }
}

/* =========================================================================
   Кабинет — скролл, профиль редактирование
   ========================================================================= */

.scroll-table {
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.scroll-news {
  max-height: 250px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.scroll-news .news-item:last-child {
  padding-bottom: 8px;
}

.profile-edit label {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.profile-edit input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .88rem;
  background: var(--bg);
  margin-bottom: 6px;
  box-sizing: border-box;
}

.profile-edit input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.profile-note {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.profile-field {
  margin-bottom: 4px;
}

.phone-field {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 0 12px;
  margin-bottom: 6px;
  box-sizing: border-box;
}

.phone-field:focus-within {
  border-color: var(--primary);
  background: #fff;
}

.phone-prefix {
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  padding-right: 3px;
  white-space: nowrap;
  user-select: none;
}

.phone-field .phone-input {
  flex: 1;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 8px 0 8px 2px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: .88rem;
  box-sizing: border-box;
}

.phone-field .phone-input:focus {
  outline: none;
  border: none;
  background: transparent;
}

/* -------------------------------------------------------------------------
   Админ-таблица — ровное выравнивание
   ------------------------------------------------------------------------- */

.admin-table th,
.admin-table td {
  vertical-align: middle;
  padding: 12px 10px !important;
  line-height: 1.4;
}

.admin-table td .muted {
  font-size: .78rem;
}

.admin-table .actions {
  gap: 4px;
}
/* =========================================================================
   Поддержка: обращения, чат, FAQ
   ========================================================================= */

.ticket-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-main { flex: 1; min-width: 0; }
.ticket-subject {
  font-weight: 600;
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-meta { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.ticket-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.ticket-row-closed { opacity: .65; }

.dot-new {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 4px;
  vertical-align: middle;
}

.cat-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cat-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.form .cat-option {
  display: flex;
  margin-bottom: 0;
  font-size: .85rem;
  color: var(--text);
}
.cat-option:hover { border-color: #d7dce6; }
.cat-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cat-option:focus-within {
  outline: 2px solid rgba(59, 91, 219, .35);
  outline-offset: 1px;
}
.cat-option:has(input:checked) {
  border-color: var(--primary);
  background: #f3f6ff;
  box-shadow: 0 0 0 3px rgba(59, 91, 219, .08);
}
.cat-emoji {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--bg);
  font-size: .95rem;
  transition: background .15s;
}
.cat-option:has(input:checked) .cat-emoji { background: #dfe6ff; }
.cat-title { font-weight: 600; font-size: .85rem; flex: 1; color: var(--text); }
.cat-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid #dfe3ea;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  line-height: 1;
  color: transparent;
  transition: all .15s;
}
.cat-option:has(input:checked) .cat-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.field-label {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.char-count {
  font-size: .7rem;
  color: var(--muted);
  text-align: right;
  margin: -4px 2px 8px;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}
.msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: .85rem;
}
.msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-admin {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-time { font-size: .68rem; opacity: .75; margin-top: 3px; }

.faq-item { border-bottom: 1px solid var(--border); padding: 8px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: .86rem; }
.faq-answer { font-size: .84rem; color: #444; padding: 8px 0 2px; line-height: 1.5; }

.faq-admin-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.faq-admin-item:last-child { border-bottom: none; }

/* Живые обновления чата */
.jump-new {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.jump-new:hover { background: var(--primary-dark); }

/* =========================================================================
   Кабинет: профиль, тариф, дни, поддержка — улучшенная вёрстка
   ========================================================================= */

a.logo {
  text-decoration: none;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: .02em;
  font-size: 1.02rem;
}
a.logo:hover { opacity: .85; }

.topnav a.active {
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.profile-head-text { min-width: 0; }
.profile-name { font-weight: 700; font-size: .95rem; }
.profile-meta { font-size: .78rem; color: var(--muted); margin-top: 1px; }

.profile-edit .profile-field { margin-bottom: 10px; }

.label-note {
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 400;
  font-size: .7rem;
}

.profile-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.profile-actions[hidden] { display: none; }
.profile-actions .btn { flex: 1; width: auto; }

.tariff-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tariff-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.tariff-name { font-size: .95rem; font-weight: 700; }
.tariff-price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}
.tariff-price span { font-size: .72rem; font-weight: 500; color: var(--muted); }

.days-card { padding: 12px 16px; }
.days-side { flex: 1; }
.days-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.days-text { font-size: .86rem; color: var(--text); }

.count-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  font-size: .7rem;
  font-weight: 600;
}

.row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: .9rem; font-weight: 700; }
.row-note { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.row-note.tg-ok { color: var(--green); }
.row-note.tg-warn { color: var(--amber); }

.tg-row { gap: 6px; }
.tg-at {
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
  padding-left: 2px;
}
.tg-status.tg-ok { color: var(--green); }
.tg-status.tg-warn { color: var(--amber); }

.field-warn {
  font-size: .74rem;
  color: var(--amber);
  margin-top: 4px;
}
.profile-actions .btn-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.profile-actions .btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

/* Шапка: аккуратный перенос меню на узких экранах */
.topnav { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .topbar-inner { gap: 6px; }
  .topnav { gap: 0; }
  .topnav a { padding: 3px 6px; font-size: .72rem; }
  a.logo { font-size: .95rem; }
}

/* =========================================================================
   Страница оплаты
   ========================================================================= */

.pay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.pay-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 1px;
}
.pay-sum {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}
.pay-sum span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}
.pay-info { text-align: right; min-width: 0; }
.pay-title { font-size: .86rem; font-weight: 700; }
.pay-info .muted { font-size: .76rem; margin-top: 1px; }

.pay-steps { padding: 12px 16px; }
.pay-step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: .84rem;
  color: var(--text);
  padding: 4px 0;
}
.pay-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.req-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.requisites pre {
  user-select: all;
}

.btn-cancel {
  width: 100%;
  background: none;
  border: none;
  padding: 9px 12px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.btn-cancel:hover {
  background: #fef2f2;
  color: var(--red);
}
