/* Личный кабинет — использует токены и .btn/.container из site.css, добавляет
   компоненты рабочего экрана: карточки статуса, формы, список устройств. */

body { min-height: 100vh; }

.auth-shell { min-height: calc(100vh - 68px); display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); padding: 36px; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-variant); border-radius: 999px; padding: 4px; margin-bottom: 26px; }
.auth-tab { flex: 1; border: none; background: none; color: var(--text-muted); padding: 9px; border-radius: 999px; font-weight: 700; font-size: 13.5px; font-family: var(--font-display); }
.auth-tab[aria-selected="true"] { background: var(--accent-strong); color: #fff; }
/* Теперь это h1 (было div): без сброса браузер добавит собственные крупные
   поля сверху и снизу и увеличит шрифт, разъехав карточку входа. */
.auth-title { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.auth-sub { color: var(--text-faint); font-size: 13.5px; margin-bottom: 22px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.field input {
  background: var(--bg-raised); border: 1px solid var(--outline-control); border-radius: var(--radius-sm);
  /* 16px на мобильном обязательны: Safari на iOS увеличивает страницу при
     фокусе на поле с меньшим шрифтом, и после ввода лендинг остаётся в зуме
     с горизонтальной прокруткой. На широких экранах возвращаем прежний размер. */
  padding: 11px 13px; color: var(--text); font-size: 16px; font-family: inherit;
}
@media (min-width: 768px) {
  .field input { font-size: 14.5px; }
}
/* outline: none без замены означал, что при обходе табом не видно, где ты
   находишься: единственным признаком фокуса была смена цвета рамки в 1px,
   а сама рамка имела контраст 1.36 к фону поля. Кольцо возвращаем. */
.field input:focus { border-color: var(--accent); }
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.password-row { position: relative; display: flex; }
.password-row input { flex: 1; padding-right: 42px; }
.btn-eye { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 34px; background: none; border: none; color: var(--text-faint); font-size: 15px; }
.field-error { font-size: 12.5px; color: var(--error-text); min-height: 15px; }
.field-hint { font-size: 12px; color: var(--text-faint); }
/* Это кнопки, а не ссылки: у них нет адреса, они запускают действие на
   странице. Раньше были <a> без href — такой элемент не попадает в обход
   табом, не срабатывает по Enter и не объявляется программой чтения экрана,
   то есть восстановить пароль с клавиатуры было физически нельзя. */
.link-inline {
  background: none; border: none; padding: 0;
  font-family: inherit; text-align: inherit; cursor: pointer;
  color: var(--accent); font-weight: 600; font-size: 13px;
}
.link-inline:hover { text-decoration: underline; }
.auth-switch { margin-top: 20px; text-align: center; font-size: 13.5px; color: var(--text-faint); }
.code-digits { display: flex; gap: 8px; }
.code-digits input {
  width: 42px; height: 50px; text-align: center; font-size: 20px; font-family: var(--font-display); font-weight: 700;
}

/* ---------- Dashboard shell ---------- */
.dash-nav { position: sticky; top: 0; z-index: 30; background: rgba(10,13,21,0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--outline-soft); }
.dash-nav-row { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.dash-main { max-width: 880px; margin: 0 auto; padding: 40px 24px 80px; display: flex; flex-direction: column; gap: 28px; }

.card { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius); padding: 26px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--success-soft); color: var(--success-glow); }
.badge-trial { background: var(--accent-soft); color: var(--accent); }
.badge-grace { background: var(--warning-soft); color: #FFB35C; }
.badge-expired, .badge-none { background: var(--error-soft); color: #FF6B75; }

.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }
@media (max-width: 640px) { .status-grid { grid-template-columns: 1fr 1fr; } }
.status-metric-label { font-size: 12px; color: var(--text-faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.status-metric-value { font-family: var(--font-display); font-size: 20px; font-weight: 800; }

/* Трек на --surface-variant давал 1.12 к карточке — пустой части полосы почти
   не видно, и полоса читалась как «залито целиком». 3.06 к --surface. */
.progress-track { height: 8px; border-radius: 999px; background: var(--outline-control); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); border-radius: 999px; transition: width 0.3s ease; }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-faint); margin-top: 8px; }

.empty-state { text-align: center; padding: 20px 0; }
.empty-state p { color: var(--text-muted); margin-bottom: 18px; font-size: 14px; }

.plan-mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .plan-mini-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .plan-mini-grid { grid-template-columns: 1fr; } }
.plan-mini {
  background: var(--bg-raised); border: 1px solid var(--outline); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.plan-mini.current { border-color: var(--accent); }
.plan-mini-name { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.plan-mini-price { font-family: var(--font-display); font-size: 21px; font-weight: 800; }
.plan-mini-price span { font-size: 12px; color: var(--text-faint); font-weight: 600; }

.device-list { display: flex; flex-direction: column; gap: 1px; background: var(--outline); border-radius: var(--radius-sm); overflow: hidden; }
.device-row { background: var(--bg-raised); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.device-name { font-weight: 700; font-size: 14px; }
.device-meta { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-danger-ghost { background: none; border: 1px solid var(--outline); color: #FF6B75; }
.btn-danger-ghost:hover { border-color: var(--error); background: var(--error-soft); }

.telegram-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.telegram-row p { color: var(--text-muted); font-size: 13.5px; max-width: 380px; }

.danger-zone { border-color: var(--error-soft); }
.danger-zone .card-head h2 { color: #FF6B75; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-variant); border: 1px solid var(--outline); color: var(--text);
  padding: 13px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 100;
}
.toast-error { border-color: var(--error); color: #FF9AA2; }
.toast-success { border-color: var(--success); color: var(--success-glow); }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Телевизор и роутер ---------- */
.muted-note { color: var(--text-muted); font-size: 13.5px; line-height: 1.5; margin-bottom: 14px; }
.card-sep { border: none; border-top: 1px solid var(--outline); margin: 22px 0; }
.field-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
/* Конфиг длинный и его копируют целиком — моноширинный, с переносом и прокруткой,
   чтобы карточка не растягивалась по ширине страницы. */
.config-box {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}
.config-box:focus { border-color: var(--accent); }
.config-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Видно программам чтения экрана, не видно глазами. display:none и
   visibility:hidden не подходят — они убирают элемент и из дерева
   доступности тоже, то есть заголовок перестал бы существовать вовсе. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Три вкладки на 320px не помещались: у .auth-tab стоит flex:1, но min-width у
   flex-элемента по умолчанию auto, то есть сжатие упирается в ширину слова.
   «Регистрация» переносить нечего — строка уезжала за карточку вместе с
   горизонтальной прокруткой на первом же экране продукта. */
.auth-tab { min-width: 0; }

@media (max-width: 400px) {
  .auth-shell { padding: 24px 12px; }
  .auth-card { padding: 24px 18px; }
  .auth-tab { padding: 9px 4px; font-size: 12.5px; }
}

/* Тост принимает сообщения сервера целиком. Без ограничения ширины длинная
   ошибка растягивала его шире экрана, а из-за position:fixed страница не
   прокручивается — хвост текста пропадал безвозвратно. */
.toast {
  max-width: min(calc(100vw - 32px), 420px);
  border-radius: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}
