/* GFarm — Mini App. Серьёзная просторная тема, SVG-иконки, без emoji. */

:root {
  --bg: #10141b;
  --bg-soft: #151b24;
  --card: #1a222e;
  --card-hover: #1f2936;
  --line: #283342;
  --text: #e8edf3;
  --muted: #8b98a8;
  --accent: #4f8ef7;
  --accent-soft: rgba(79, 142, 247, 0.14);
  --green: #3fb27f;
  --green-soft: rgba(63, 178, 127, 0.14);
  --red: #e05c5c;
  --red-soft: rgba(224, 92, 92, 0.14);
  --amber: #d9a441;
  --amber-soft: rgba(217, 164, 65, 0.14);
  --radius: 14px;
  --gap: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); font-size: 13.5px; margin: 10px 0 0; }
code {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
}

svg { display: block; }
.svg-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.svg-icon.lg { width: 22px; height: 22px; }

/* ── кнопки ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 11px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:hover { background: var(--card-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #63a0f8; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.icon-btn { padding: 9px; border-radius: 10px; }
.btn.danger { color: var(--red); border-color: rgba(224, 92, 92, 0.4); }
.btn.danger:hover { background: var(--red-soft); }
.btn.success { color: var(--green); border-color: rgba(63, 178, 127, 0.4); }
.btn.success:hover { background: var(--green-soft); }
.btn.warn { color: var(--amber); border-color: rgba(217, 164, 65, 0.4); }
.btn.warn:hover { background: var(--amber-soft); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* Спиннер внутри action-кнопки на время запроса (2026-09-01). */
.btn.loading, .chip.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}
.btn.loading::after, .chip.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--muted);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
.switch.loading { opacity: 0.5; pointer-events: none; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

input, select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  outline: none;
  min-width: 0;
}
input:focus { border-color: var(--accent); }

/* Windows/desktop webview: нативные белые спиннеры числа и вплотную
   прижатая стрелка select выбивались из темы (2026-08-30). */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
/* appearance:auto оставляет нативный контрол: на macOS WKWebView он игнорирует
   вертикальные padding и сжимается (~30px против ~45px у input) — селекты
   статусов/айфонов выглядели сплюснутыми на макбуке при нормальном виде на
   Windows (2026-09-05). Отключаем нативный вид везде, рисуем свою стрелку
   и фиксируем высоту как у полей ввода. */
select {
  padding-right: 34px;
  -webkit-appearance: none;
  appearance: none;
  min-height: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%238b98a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ── вход ───────────────────────────────────────── */
#gate {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 28px 28px;
  text-align: center;
}
.gate-logo { width: 56px; height: 56px; margin: 0 auto 14px; color: var(--accent); }
.gate-logo svg { width: 100%; height: 100%; }
.gate-title { margin: 0 0 4px; font-size: 26px; letter-spacing: 0.4px; }
.gate-card .muted { margin: 0 0 22px; font-size: 13.5px; }
.gate-card .btn { margin-top: 12px; }

/* ── верхняя панель ─────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; color: var(--accent); flex: 0 0 auto; }
.brand-mark svg { width: 100%; height: 100%; }
.topbar-title { font-size: 22px; font-weight: 650; letter-spacing: 0.3px; }
/* Строка бейджей под брендом: оба растягиваются и делят всю ширину
   ровно над кнопками разделов (2026-08-31). */
.topbar-sub {
  display: flex;
  gap: 8px;
  padding: 0 18px 10px;
  font-size: 12.5px;
}
.topbar-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  color: var(--muted);
  white-space: nowrap;
}

/* ── вкладки ────────────────────────────────────── */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 18px 14px;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 4px 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  min-width: 0;
}
.tab .tab-label {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab.active {
  background: var(--accent-soft);
  border-color: rgba(79, 142, 247, 0.35);
  color: var(--accent);
}

/* ── контент ────────────────────────────────────── */
/* relative — уходящая страница при анимации перехода позиционируется
   абсолютно внутри #content, без скачка высоты (2026-09-09). */
#content { position: relative; }
.tabpage { padding: 0 18px 28px; display: flex; flex-direction: column; gap: var(--gap); }

/* Переходы между разделами: fade + лёгкий сдвиг за 200мс (2026-09-09).
   Уходящая (.tab-leaving + .tab-to-*) уплывает в сторону перехода,
   входящая (.tab-from-*) стартует с противоположной и приезжает в ноль —
   классы ставит/снимает switchTab() в app.js. */
.tabpage { transition: opacity 0.2s ease, transform 0.2s ease; }
.tabpage.tab-leaving {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  opacity: 0;
}
.tabpage.tab-to-left { transform: translateX(-16px); }
.tabpage.tab-to-right { transform: translateX(16px); }
.tabpage.tab-from-left { opacity: 0; transform: translateX(-16px); }
.tabpage.tab-from-right { opacity: 0; transform: translateX(16px); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}
.card h3 { margin: 0 0 12px; font-size: 15.5px; font-weight: 620; }
.card p { margin: 0 0 10px; font-size: 13.5px; }
.card p:last-child { margin-bottom: 0; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 620;
  color: var(--muted);
  margin: 22px 2px 4px;
  letter-spacing: 0.2px;
}
.section-title:first-child { margin-top: 2px; }

/* ── агенты и устройства ────────────────────────── */
.agent-block { display: flex; flex-direction: column; gap: 10px; }
.agent-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 4px;
  font-size: 14px;
  font-weight: 620;
  min-width: 0;
}
.agent-head .host {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.agent-head .muted { font-weight: 400; font-size: 12.5px; flex: 0 0 auto; }

/* Сворачивание блока айфонов хоста (2026-10-01): шеврон в заголовке,
   по умолчанию развёрнуто (шеврон вниз), collapsed — вправо. */
.agent-devices { display: flex; flex-direction: column; gap: 10px; }
.agent-block.collapsed .agent-devices { display: none; }
.agent-head .host-toggle { margin-left: auto; flex: 0 0 auto; padding: 4px; }
.agent-head .host-chevron { transform: rotate(90deg); transition: transform 0.15s ease; }
.agent-block.collapsed .host-chevron { transform: rotate(0deg); }

/* Подзаголовок пачки Apple ID (2026-10-14): «Пачка A · хранитель: …»;
   без хранителя — янтарное предупреждение (прогоны пачки заблокированы). */
.group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 2px -2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.group-head svg { width: 15px; height: 15px; flex: 0 0 auto; }
.group-head .group-keeper {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--amber);
}
.group-head.no-keeper { color: var(--amber); }
.group-head .group-warn {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--red);
}

.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dot.on { background: var(--green); box-shadow: 0 0 6px rgba(63, 178, 127, 0.6); }
.dot.off { background: var(--red); }
.dot.idle { background: var(--muted); }
.dot.warn { background: var(--amber); }

.device-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s;
  min-width: 0;
}
.device-card:hover { background: var(--card-hover); }
.device-main { flex: 1 1 auto; min-width: 0; }
.device-name {
  font-size: 15.5px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
/* Единая раскладка бейджиков: 2+2 либо по одному в строку (2026-08-31). */
#tab-devices.badges-paired .device-badges { flex-wrap: nowrap; }
#tab-devices.badges-paired .device-badges .badge {
  max-width: calc(50% - 3px);
  flex: 0 1 calc(50% - 3px);
}
#tab-devices.badges-paired .device-badges {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
#tab-devices.badges-stacked .device-badges { flex-direction: column; flex-wrap: nowrap; }
#tab-devices.badges-stacked .device-badges .badge { max-width: 100%; width: 100%; }
.device-chevron { color: var(--muted); flex: 0 0 auto; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 11.5px;
  line-height: 1.2;
  color: var(--muted);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge.green { color: var(--green); border-color: rgba(63, 178, 127, 0.35); background: var(--green-soft); }
.badge.red { color: var(--red); border-color: rgba(224, 92, 92, 0.35); background: var(--red-soft); }
.badge.amber { color: var(--amber); border-color: rgba(217, 164, 65, 0.35); background: var(--amber-soft); }
.badge.blue { color: var(--accent); border-color: rgba(79, 142, 247, 0.35); background: var(--accent-soft); }
.badge.has-hint { cursor: pointer; }
.badge.has-hint:active { filter: brightness(1.25); }

/* ── статистика ─────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  min-width: 0;
}
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  min-width: 0;
}
.stat-row:first-of-type { border-top: none; }
.stat-row > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-row > span:last-child { text-align: right; flex: 0 0 auto; }

/* Строка устройства в статистике: имя отдельной строкой, числа ниже —
   длинные имена («iPhone 12 White-1») ничего не обрезают (2026-08-30). */
.stat-row-v {
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.stat-row-v:first-of-type { border-top: none; }
.stat-row-name {
  font-size: 13.5px;
  font-weight: 620;
  overflow-wrap: anywhere;
  margin-bottom: 3px;
}
.stat-row-name .muted { font-weight: 400; font-size: 12px; }
.stat-row-values {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  font-size: 12.5px;
  color: var(--text);
}

/* ── сворачиваемые секции «По приложениям» ─────── */
.appstats-head { cursor: pointer; user-select: none; }
.appstats-arrow { width: 12px; flex: 0 0 auto; }
.appstats-section.collapsed .appstats-body { display: none; }

/* Панель «период» под заголовком «По приложениям» (2026-10-08; select
   устройства убран — выбор раскрытием секций). */
.appstats-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 2px 0 10px;
}
.appstats-period { display: flex; gap: 6px; }

/* ── бар трафика proxy001 ─────────────────────── */
.flow-card { margin-bottom: var(--gap); }
.flow-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.flow-head h3 { margin: 0; }
.flow-meta { font-size: 12.5px; color: var(--muted); }
.flow-meta b { color: var(--text); }
.flow-meta b.flow-low { color: var(--red); }
.flow-bar {
  margin-top: 10px;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.flow-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.flow-bar-fill.low { background: var(--red); }
.flow-hours { margin-top: 10px; }
.flow-hours.collapsed { display: none; }
.flow-hour-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.flow-hour-row:first-child { border-top: none; }

/* ── аккаунты ───────────────────────────────────── */
.account-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 10px;
  min-width: 0;
  /* Тап по карточке открывает детали аккаунта (2026-09-25). */
  cursor: pointer;
}
.account-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.account-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.account-email {
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
  /* Слева, сразу правее чекбокса экспорта: забирает свободную ширину,
     кнопки действий прижаты вправо (2026-09-21). */
  flex: 1 1 auto;
  text-align: left;
}
.account-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.export-form {
  display: grid;
  /* minmax(0,…): иначе длинный контент date-поля («27 авг. 2026 г.»)
     распирает 1fr-треки и вся форма уезжает за край карточки (2026-08-31). */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
/* Даты на узком экране в русской локали длинные («19 авг. 2026 г.») —
   каждая получает всю ширину, иначе поля налезают друг на друга (2026-08-30).
   Поле — text с placeholder; в момент выбора JS переключает его в date
   (у пустого date-поля iOS не рисует placeholder вообще). */
.export-form input[type="date"],
.export-form .date-field {
  text-align: left;
  font-size: 13.5px;
  min-height: 46px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  /* iOS: нативный date-контрол игнорирует width и растёт по длине
     отформатированной даты; appearance:none возвращает ему обычный бокс. */
  -webkit-appearance: none;
  appearance: none;
}
/* Даты — одной строкой, строка поиска — на всю ширину под ними
   (2026-09-07). */
.export-dates {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}
.export-form #export-q {
  grid-column: 1 / -1;
  min-height: 46px;
  width: 100%;
  min-width: 0;
}
.export-form input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check-row input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  padding: 0;
}
/* Тройной переключатель фильтров аккаунтов (2026-10-09): есть/нет/все,
   применяется сразу, без обязательного нажатия «Поиск». */
.tristate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
}
.tristate {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.tristate button {
  border: 0;
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tristate button + button { border-left: 1px solid var(--line); }
.tristate button.active {
  background: var(--accent-soft);
  color: var(--accent);
}
/* Чекбокс точечного экспорта на карточке готового аккаунта (2026-09-21). */
.export-pick {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  cursor: pointer;
}
.export-pick input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  padding: 0;
  margin: 0;
  cursor: pointer;
}
/* «Выбрать все» под заголовком «Готовые» (2026-09-21). */
.select-all-row {
  margin: 2px 0 10px 2px;
}
.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
/* Сортировка списков аккаунтов — отдельно от фильтров, под кнопками
   (2026-09-10); применяется сразу по change, без кнопки. */
.sort-select {
  width: 100%;
  min-height: 46px;
  margin-top: 12px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 6px 0 12px;
}
.pager .btn.small { padding: 6px 14px; }
.pager .btn:disabled { opacity: 0.35; }
.pager-info {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.export-lines {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
  font: 11.5px/1.55 ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 240px;
  overflow-y: auto;
}
.sale-link {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.sale-note { color: var(--muted); font-size: 11.5px; margin-top: 4px; }

/* ── модалка ────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 88%;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
.modal-title { min-width: 0; }
.modal-title h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-udid {
  font: 11px ui-monospace, Menlo, monospace;
  color: var(--muted);
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.modal-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.modal-actions .btn { flex-direction: column; gap: 6px; padding: 12px 6px; font-size: 12px; white-space: normal; }

.modal-section .label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 9px;
  letter-spacing: 0.2px;
}

.name-row { display: flex; gap: 8px; }
.name-row input { flex: 1 1 auto; }
.name-row .btn { flex: 0 0 auto; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.switch {
  position: relative;
  width: 46px;
  height: 27px;
  border-radius: 14px;
  background: var(--line);
  border: none;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}
.switch.on { background: var(--green); }
.switch.on::after { left: 22px; }

/* Тумблер «Хранитель Apple ID» (2026-10-14): действие меняет роль
   устройства (отключает прогоны/erase) — визуально выделен от обычных
   настроек, включённое состояние янтарное, а не зелёное. */
.keeper-row {
  margin-top: 4px;
  padding: 11px 12px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: var(--amber-soft);
  font-weight: 600;
}
.switch.keeper { outline: 2px solid transparent; }
.switch.keeper.on { background: var(--amber); }

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 9px;
  padding: 7px 13px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.chip.active {
  background: var(--accent-soft);
  border-color: rgba(79, 142, 247, 0.45);
  color: var(--accent);
}

.log-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  font: 10.5px/1.55 ui-monospace, Menlo, monospace;
  color: var(--muted);
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── модалка подтверждения удаления аккаунта ────── */
.confirm-card { max-width: 420px; gap: 14px; }
.confirm-text { font-size: 14.5px; overflow-wrap: anywhere; }
.confirm-text b { font-weight: 650; }
.confirm-options { display: flex; flex-direction: column; gap: 10px; }
.confirm-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  cursor: pointer;
}
.confirm-options label.disabled { color: var(--muted); cursor: default; }
.confirm-options input { accent-color: var(--red); width: 16px; height: 16px; flex: 0 0 auto; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; justify-content: center; }

/* ── детали аккаунта (тап по карточке) ──────────── */
.detail-rows { display: flex; flex-direction: column; gap: 8px; }
.detail-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
}
.detail-row.copyable { cursor: pointer; }
.detail-row.copyable:active { border-color: var(--accent); }
.detail-label { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.detail-value {
  font: 13px ui-monospace, Menlo, monospace;
  overflow-wrap: anywhere;
  user-select: text;
}

/* ── тост ───────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 18px;
  font-size: 13.5px;
  z-index: 60;
  max-width: calc(100vw - 48px);
  overflow-wrap: anywhere;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

/* Сессии мини-аппа (раздел «Ферма», 2026-09-28) */
.session-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.session-row:first-child { border-top: none; padding-top: 0; }
.session-info { flex: 1; min-width: 0; }
.session-name { font-weight: 650; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.confirm-options label.session-pw { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.confirm-options label.session-pw input { width: 100%; }
.session-facts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.owner-pw-row { display: flex; gap: 10px; }
.owner-pw-row input { flex: 1; min-width: 0; }
.owner-pw-row .btn { flex: 0 0 auto; }
.sessions-revoke-all { width: 100%; justify-content: center; margin-top: 12px; }
