/* Панель автопостинга — мини-приложение Telegram.
   Цвета — из темы Telegram (переменные --tg-theme-*), так панель выглядит
   родной и в светлой, и в тёмной теме; запасные значения — для браузера. */

:root {
  --bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --accent: var(--tg-theme-button-color, #2f80ed);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, var(--accent));
  --head: var(--tg-theme-section-header-text-color, var(--hint));
  --danger: var(--tg-theme-destructive-text-color, #ff3b30);
  --sep: var(--tg-theme-section-separator-color, rgba(60, 60, 67, 0.16));

  --green: #30b350;
  --orange: #f28c00;
  --red: #ff3b30;
  --blue: #0a84ff;
  --purple: #a550d8;
  --gray: #8e8e93;

  --well: rgba(118, 118, 128, 0.12);
  --press: rgba(0, 0, 0, 0.05);
  --accent-soft: rgba(47, 128, 237, 0.13);
  --danger-soft: rgba(255, 59, 48, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);

  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --tabs-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --danger-soft: color-mix(in srgb, var(--danger) 12%, transparent);
  }
}

:root[data-scheme="dark"] {
  --well: rgba(118, 118, 128, 0.24);
  --press: rgba(255, 255, 255, 0.06);
  --shadow: none;
  --green: #32d74b;
  --orange: #ff9f0a;
  --red: #ff453a;
}

/* Не в Telegram и тёмная тема системы — свои тёмные цвета. */
:root[data-scheme="dark"]:not([data-tg]) {
  --bg: #000000;
  --card: #1c1c1e;
  --text: #ffffff;
  --hint: #8d8d93;
  --accent: #3e8ef7;
  --sep: rgba(84, 84, 88, 0.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; overscroll-behavior-y: none; }
body.locked { overflow: hidden; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }

.app { padding-bottom: calc(var(--tabs-h) + var(--safe-bottom) + 8px); }
.page { max-width: 640px; margin: 0 auto; padding: 4px 16px 24px; animation: fade-in 0.18s ease-out; }

@keyframes fade-in { from { opacity: 0.4; } to { opacity: 1; } }

/* -- заголовок раздела -- */
.ltitle {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 14px;
}
.ltitle h1 { font-size: 31px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.ltitle p { margin-top: 4px; color: var(--hint); font-size: 15px; }
.ltitle p::first-letter { text-transform: uppercase; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--well);
  color: var(--hint);
}
.accent-btn { width: 40px; height: 40px; background: var(--accent); color: var(--accent-text); box-shadow: 0 4px 14px var(--accent-soft); }
.accent-btn:active { transform: scale(0.94); }

/* -- карточки и списки -- */
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.cards { display: grid; gap: 12px; }

.sec { margin-top: 24px; }
.sec-h {
  padding: 0 16px 7px;
  color: var(--head);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.sec-f { padding: 8px 16px 0; color: var(--hint); font-size: 13px; line-height: 1.4; }
.center { text-align: center; }

.list { overflow: hidden; }
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 16px;
  border: 0;
  background: none;
  text-align: left;
}
.row + .row::before, .list > .hours + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 58px;
  height: 1px;
  background: var(--sep);
  transform: scaleY(0.5);
  transform-origin: top;
}
.row.tap:active { background: var(--press); }
.row-lead { display: inline-flex; flex: none; }
.row-body { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.row-title { font-size: 16px; font-weight: 500; }
.row-sub {
  display: -webkit-box;
  overflow: hidden;
  color: var(--hint);
  font-size: 13.5px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.row-err { display: block; margin-top: 2px; color: var(--hint); font-size: 12.5px; word-break: break-word; }
.row-value { flex: none; max-width: 45%; color: var(--hint); font-size: 15px; text-align: right; }
.row-chev { color: var(--hint); opacity: 0.6; }
.row.danger .row-title { color: var(--danger); }
.row-link { display: inline-grid; place-items: center; width: 34px; height: 34px; color: var(--link); }
.row-stack { flex-wrap: wrap; }
.row-stack .inline-input { flex-basis: 100%; margin-left: 42px; }

.tile {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
}
.tile.tone-accent { background: var(--accent); color: var(--accent-text); }
.tile.tone-green { background: var(--green); }
.tile.tone-orange { background: var(--orange); }
.tile.tone-red { background: var(--red); }
.tile.tone-blue { background: var(--blue); }
.tile.tone-purple { background: var(--purple); }
.tile.tone-gray { background: var(--gray); }

.pbadge {
  position: relative;
  display: inline-grid;
  flex: none;
  place-items: center;
  border-radius: 28%;
  color: #fff;
}
.pbadge svg { display: block; }
:root[data-scheme="dark"] .pbadge.pb-tiktok { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.pbadge b {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border: 2px solid var(--card);
  border-radius: 8px;
  background: #fe2c55;
  font-size: 9px;
  font-weight: 800;
  line-height: 11px;
  text-align: center;
}

/* -- чипы -- */
.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.tone-green { background: rgba(48, 179, 80, 0.14); color: var(--green); }
.chip.tone-orange { background: rgba(242, 140, 0, 0.14); color: var(--orange); }
.chip.tone-red { background: rgba(255, 59, 48, 0.12); color: var(--red); }
.chip.tone-blue { background: rgba(10, 132, 255, 0.13); color: var(--blue); }
.chip.tone-gray { background: var(--well); color: var(--hint); }
.chip.tone-accent { background: var(--accent-soft); color: var(--accent); }
.tone-text-green { color: var(--green); }
.tone-text-orange { color: var(--orange); }
.tone-text-red { color: var(--red); }
.tone-text-blue { color: var(--blue); }
.tone-text-gray { color: var(--hint); }

/* -- карточка канала на сводке -- */
.ch-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  padding: 16px;
  border: 0;
  text-align: left;
  transition: transform 0.15s ease;
}
.ch-card:active { transform: scale(0.985); }
.ch-head { display: flex; align-items: center; gap: 12px; }
.ch-ic {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  color: #fff;
}
.ch-ic.tone-accent { background: linear-gradient(135deg, #22e3c4, #1aa3d9); }
.ch-ic.tone-purple { background: linear-gradient(135deg, #ff7a2f, #e0457b); }
.ch-titles { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.ch-titles b { font-size: 17px; font-weight: 600; }
.ch-titles span { overflow: hidden; color: var(--hint); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric { display: flex; flex-direction: column; gap: 1px; }
.metric b { font-size: 30px; line-height: 1.05; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.metric span { color: var(--hint); font-size: 13px; }
.metric em { color: var(--orange); font-size: 12px; font-style: normal; }

.next {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px 10px 10px;
  border-radius: 12px;
  background: var(--bg);
}
.next-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.next-when { display: inline-flex; align-items: center; gap: 5px; color: var(--hint); font-size: 13px; }
.next-text b { overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.next-chip { display: flex; margin-top: 3px; }
.next.idle { gap: 10px; padding: 12px; color: var(--hint); font-size: 14px; line-height: 1.35; }

.ch-foot { display: grid; gap: 7px; color: var(--hint); font-size: 13px; }
.bar { display: block; overflow: hidden; height: 6px; border-radius: 3px; background: var(--well); }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.4s ease; }

.mini-badges { display: inline-flex; gap: 3px; }
.sub-line { display: inline-flex; align-items: center; gap: 8px; }
.sub-acc, .sub-stat { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -- обложки -- */
.thumb {
  position: relative;
  display: inline-block;
  flex: none;
  overflow: hidden;
  width: 54px;
  height: 96px;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--well), rgba(118, 118, 128, 0.2));
}
.thumb img { position: absolute; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--hint); opacity: 0.7; }
.thumb-n {
  position: absolute;
  z-index: 2;
  top: 5px;
  left: 5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  backdrop-filter: blur(6px);
}
.thumb-t {
  position: absolute;
  z-index: 2;
  right: 4px;
  bottom: 4px;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.thumb-sm { width: 36px; height: 64px; border-radius: 8px; }
.thumb-xs { width: 30px; height: 53px; border-radius: 6px; }
.thumb-lg { width: min(62vw, 260px); height: auto; aspect-ratio: 9 / 16; border-radius: 14px; }

/* -- очередь -- */
.seg {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 2px;
  padding: 2px;
  border-radius: 11px;
  background: var(--well);
}
.seg-b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 14.5px;
  font-weight: 600;
  transition: background 0.2s ease;
}
.seg-b.on { background: var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.seg-n {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--well);
  color: var(--hint);
  font-size: 12px;
  line-height: 20px;
}
.seg-b.on .seg-n { background: var(--accent-soft); color: var(--accent); }

.subtabs { display: flex; gap: 6px; margin: 14px 0 10px; }
.subtabs button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  background: none;
  color: var(--hint);
  font-size: 14px;
  font-weight: 600;
}
.subtabs button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.qlist { overflow: hidden; }
.qrow {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: none;
  text-align: left;
}
.qrow + .qrow::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 78px;
  height: 1px;
  background: var(--sep);
  transform: scaleY(0.5);
}
.qrow:active { background: var(--press); }
.q-body { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.q-when { display: inline-flex; align-items: center; gap: 5px; color: var(--hint); font-size: 13px; font-weight: 500; }
.q-when.accent { color: var(--accent); font-weight: 600; }
.q-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.q-cap { overflow: hidden; color: var(--hint); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.q-chev { color: var(--hint); opacity: 0.5; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.dot-badge { position: relative; display: inline-flex; }
.dot-badge::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--gray);
}
.dot-badge.st-posted::after { background: var(--green); }
.dot-badge.st-failed::after { background: var(--red); }
.dot-badge.st-posting::after, .dot-badge.st-submitted::after { background: var(--blue); }
.dot-badge.st-pending { opacity: 0.55; }
.dot-badge.st-pending::after { background: var(--gray); }
.dot-badge.st-skipped { opacity: 0.35; }

/* -- пустые состояния -- */
.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 24px 24px; text-align: center; }
.empty-ic {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.empty h3 { font-size: 19px; font-weight: 700; }
.empty p { max-width: 320px; color: var(--hint); font-size: 15px; line-height: 1.4; }
.empty-actions { display: grid; gap: 8px; width: min(100%, 300px); margin-top: 14px; }

/* -- кнопки -- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.2s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.busy:disabled { opacity: 0.75; }
.btn.wide { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-tinted { background: var(--accent-soft); color: var(--accent); }
.btn-plain { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }

.actions { display: grid; gap: 10px; margin: 16px 0; }
.actions-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.actions-row .btn { flex-direction: column; gap: 3px; min-height: 62px; padding: 8px 4px; font-size: 13px; }

/* -- переключатель -- */
.switch { position: relative; display: inline-block; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.knob {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--well);
  transition: background 0.2s ease;
}
.knob::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.3, 1.2);
}
.switch input:checked + .knob { background: var(--green); }
.switch input:checked + .knob::after { transform: translateX(20px); }
.switch input:disabled + .knob { opacity: 0.45; }

/* -- поля -- */
.inline-input {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  outline: none;
  background: var(--bg);
  font-size: 16px;
}
.form { overflow: hidden; }
.field { display: block; padding: 12px 16px; }
.field + .field { border-top: 1px solid var(--sep); }
.field-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--hint);
  font-size: 13px;
  font-weight: 600;
}
.field-count { font-weight: 500; font-variant-numeric: tabular-nums; }
.field-input {
  display: block;
  width: 100%;
  padding: 6px 0 2px;
  border: 0;
  outline: none;
  background: none;
  font-size: 16px;
  line-height: 1.4;
  resize: none;
}
.field-input.mono { font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.field-hint { display: block; margin-top: 6px; color: var(--hint); font-size: 12.5px; line-height: 1.35; }
.field.card { margin: 12px 0; }

/* -- расписание -- */
.hours { padding: 4px 16px 16px; }
.hours-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.hours-grid button {
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s ease, color 0.15s ease;
}
.hours-grid button.on { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.hours-sum { margin: 12px 0; color: var(--hint); font-size: 13.5px; }
.hours-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hours-actions .btn { min-height: 38px; padding: 0 14px; font-size: 15px; }

/* -- нижняя панель разделов -- */
.tabs {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--sep);
  background: var(--card);
}
@supports (backdrop-filter: blur(1px)) {
  .tabs { background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: saturate(1.8) blur(20px); }
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  height: var(--tabs-h);
  padding-top: 7px;
  border: 0;
  background: none;
  color: var(--hint);
  font-size: 10.5px;
  font-weight: 600;
}
.tab.on { color: var(--accent); }
.tab-ic { position: relative; }
.tab-dot {
  position: absolute;
  top: -1px;
  right: -4px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--red);
}

/* -- листы -- */
.sheet-wrap { position: fixed; z-index: 50; inset: 0; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sheet {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  max-height: calc(var(--tg-viewport-stable-height, 100vh) - 24px);
  margin: 0 auto;
  border-radius: 16px 16px 0 0;
  background: var(--bg);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.sheet.tall { height: calc(var(--tg-viewport-stable-height, 100vh) - 24px); }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grab { width: 38px; height: 5px; margin: 7px auto 0; border-radius: 3px; background: var(--hint); opacity: 0.35; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 12px 8px 20px; touch-action: none; }
.sheet-title { overflow: hidden; font-size: 17px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.sheet-x { width: 30px; height: 30px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 2px 16px 28px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-body > .sec:first-child { margin-top: 8px; }
.sheet-foot { padding: 10px 16px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--sep); background: var(--bg); }
.sheet-foot[hidden] { display: none; }

.player-wrap { display: flex; justify-content: center; margin: 4px 0 12px; }
.player { display: block; max-width: 100%; max-height: 52vh; aspect-ratio: 9 / 16; border-radius: 14px; background: #000; }
.player-wrap.still { margin-bottom: 14px; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 14px; }
.readonly { display: grid; gap: 10px; padding: 14px 16px; font-size: 15px; line-height: 1.45; }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.note { display: flex; gap: 8px; color: var(--hint); }

.hero { display: flex; align-items: center; gap: 14px; padding: 6px 4px 16px; }
.hero-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.hero-text b { overflow: hidden; font-size: 19px; font-weight: 700; text-overflow: ellipsis; }
.hero-text span { color: var(--hint); font-size: 13.5px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; padding: 14px 8px; text-align: center; }
.stats div { display: flex; flex-direction: column; gap: 2px; }
.stats div + div { border-left: 1px solid var(--sep); }
.stats b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats span { color: var(--hint); font-size: 12.5px; }

.errbox {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--danger-soft);
  box-shadow: none;
  color: var(--red);
}
.errbox div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.errbox b { color: var(--text); font-size: 15px; }
.errbox span { color: var(--text); font-size: 13.5px; line-height: 1.4; opacity: 0.8; word-break: break-word; }

.opcard { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 14px 16px; }
.opcard > div { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.opcard b { font-size: 15px; }
.opcard span { color: var(--hint); font-size: 13.5px; line-height: 1.4; }
.opcard.ok > .icon { color: var(--green); }
.opcard.bad > .icon { color: var(--red); }
.shot { flex: none; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: none; }
.shot img { display: block; width: 64px; height: 42px; object-fit: cover; }
.shot-full { display: block; width: 100%; border-radius: 12px; }

.remote { display: grid; gap: 14px; margin-top: 4px; padding: 16px; }
.remote-head { display: flex; align-items: center; gap: 12px; }
.remote-head div { display: flex; flex-direction: column; gap: 2px; }
.remote-head b { font-size: 16px; }
.remote-head span { color: var(--hint); font-size: 13px; }
.steps { margin: 0; padding: 0 0 0 20px; font-size: 14.5px; line-height: 1.45; }
.steps li + li { margin-top: 5px; }
.steps.card { padding: 14px 16px 14px 34px; }
.hint { color: var(--hint); font-size: 13px; line-height: 1.4; }

.up-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.up-row + .up-row { border-top: 1px solid var(--sep); }
.up-ic { display: inline-grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--well); color: var(--hint); }
.up-ic.up-ok { background: rgba(48, 179, 80, 0.15); color: var(--green); }
.up-ic.up-error { background: rgba(255, 59, 48, 0.12); color: var(--red); }
.up-ic.up-up { color: var(--accent); }
.up-body { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.up-body b { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.up-body > span:not(.up-bar) { color: var(--hint); font-size: 13px; }
.up-bar { display: block; overflow: hidden; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--well); }
.up-bar i { display: block; height: 100%; background: var(--accent); transition: width 0.25s linear; }

/* -- спиннер, всплывашки, заглушки -- */
.spin {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  border: 2.2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.spin-sm { width: 13px; height: 13px; border-width: 2px; }
.spin-light { color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts {
  position: fixed;
  z-index: 100;
  bottom: calc(var(--tabs-h) + var(--safe-bottom) + 12px);
  left: 50%;
  display: grid;
  gap: 8px;
  width: min(calc(100vw - 32px), 440px);
  transform: translateX(-50%);
  pointer-events: none;
}
body.locked .toasts { bottom: calc(var(--safe-bottom) + 84px); }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(28, 28, 30, 0.94);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 14.5px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast.tone-ok .icon { color: #32d74b; }
.toast.tone-error .icon { color: #ff6961; }
.toast.tone-info .icon { color: #64d2ff; }

.skeleton .sk {
  border-radius: 14px;
  background: linear-gradient(90deg, var(--well) 0%, rgba(118, 118, 128, 0.06) 50%, var(--well) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.sk-title { width: 45%; height: 34px; margin: 18px 4px 8px; }
.sk-sub { width: 60%; height: 16px; margin: 0 4px 18px; }
.sk-card { height: 214px; margin-bottom: 12px; border-radius: 16px; }
.sk-row { height: 56px; margin-bottom: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

