/* F7 Moderation: Telegram Mini App panel. Colours come from the Telegram
   theme (--tg-theme-*), with fallbacks for a plain browser. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f0f2f5);
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #1b1f24);
  --hint: var(--tg-theme-hint-color, #7d8590);
  --sub: var(--tg-theme-subtitle-text-color, var(--tg-theme-hint-color, #7d8590));
  --head: var(--tg-theme-section-header-text-color, var(--tg-theme-hint-color, #6b7380));
  --link: var(--tg-theme-link-color, #2a7ae2);
  --accent: var(--tg-theme-accent-text-color, var(--tg-theme-link-color, #2a7ae2));
  --btn: var(--tg-theme-button-color, #2a7ae2);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #d93f3f);
  --sep: var(--tg-theme-section-separator-color, rgba(128, 128, 128, 0.22));
  --ok: #24914d;
  --warn: #b7791f;
  --tint: rgba(128, 128, 128, 0.12);
  --radius: 12px;
  --safe-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --tabs-h: 56px;
}

html[data-scheme="dark"] {
  --ok: #4cc47a;
  --warn: #e0a640;
  --tint: rgba(255, 255, 255, 0.08);
}

@media (prefers-color-scheme: dark) {
  html:not([data-scheme]) {
    --bg: #17191d;
    --bg2: #0f1114;
    --section: #1c1f24;
    --text: #e8eaed;
    --hint: #8b929b;
    --ok: #4cc47a;
    --warn: #e0a640;
    --tint: rgba(255, 255, 255, 0.08);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg2);
  color: var(--text);
  font: 15px/1.42 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

button:disabled { cursor: default; }

:focus-visible { outline: 2px solid var(--btn); outline-offset: 2px; }

/* ---------- top bar ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 20;
  background: var(--btn);
  animation: progress 1.1s ease-in-out infinite;
  transform-origin: left center;
}

@keyframes progress {
  0% { transform: scaleX(0.05); opacity: 1; }
  70% { transform: scaleX(0.85); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background: var(--bg2);
  border-bottom: 1px solid var(--sep);
}

.top-text { flex: 1; min-width: 0; }

.top-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-sub {
  color: var(--sub);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-sub:empty { display: none; }

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--tint);
  color: var(--link);
  font-size: 20px;
  line-height: 36px;
  padding: 0;
}

/* ---------- content ---------- */

.main {
  padding: 12px 12px calc(24px + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
  transition: opacity 0.15s;
}

body.has-tabs .main { padding-bottom: calc(var(--tabs-h) + 24px + var(--safe-bottom)); }

body.typing.has-tabs .main { padding-bottom: calc(24px + var(--safe-bottom)); }

body.loading .main { opacity: 0.55; }

.boot { margin: 48px 16px; text-align: center; color: var(--hint); }

.empty { margin: 0; padding: 14px 16px; color: var(--hint); }

.sec-title {
  margin: 18px 4px 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--head);
}

.main > :first-child.list > .sec-title,
.main > .sec-title:first-child { margin-top: 4px; }

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--section);
  padding: 12px 14px;
  text-align: left;
}

.stat-v { display: block; font-size: 24px; font-weight: 700; line-height: 1.15; }

.stat-l { display: block; color: var(--sub); font-size: 13px; margin-top: 2px; }

.stat.tap .stat-v { color: var(--link); }

/* ---------- cards, texts, lists ---------- */

.card, .list-body, .note, .form, .search {
  background: var(--section);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.card { padding: 12px 14px; border-left: 3px solid transparent; }

.card-head { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }

.card-title { font-weight: 600; font-size: 16px; }

.rows { margin: 8px 0 0; display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 4px 12px; }

.rows dt { color: var(--hint); font-size: 13px; padding-top: 1px; }

.rows dd { margin: 0; white-space: pre-wrap; }

.card-text { margin: 10px 0 0; white-space: pre-wrap; }

.note { padding: 12px 14px; border-left: 3px solid transparent; }

.note-title { display: block; font-weight: 600; margin-bottom: 4px; }

.note-text { margin: 0; white-space: pre-wrap; }

.list { margin-bottom: 4px; }

.list-body { overflow: hidden; }

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 11px 14px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
}

.item + .item { border-top: 1px solid var(--sep); }

.item.tap:active, .stat.tap:active { background: var(--tint); }

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

.item-line { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }

.item-title { display: block; font-weight: 500; min-width: 0; }

.item-sub { display: block; color: var(--sub); font-size: 13px; margin-top: 1px; }

.item-text { display: block; font-size: 14px; margin-top: 4px; white-space: pre-wrap; }

.chev { flex: none; color: var(--hint); font-size: 20px; line-height: 1; }

.badge {
  flex: none;
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--hint);
}

/* ---------- tones ---------- */

.tone-ok { border-left-color: var(--ok); }
.tone-accent { border-left-color: var(--accent); }
.tone-muted { border-left-color: transparent; }
.tone-warn { border-left-color: var(--warn); }
.tone-danger, .tone-error { border-left-color: var(--danger); }
.tone-primary { border-left-color: var(--btn); }

.badge.tone-ok { color: var(--ok); }
.badge.tone-accent { color: var(--accent); }
.badge.tone-warn { color: var(--warn); }
.badge.tone-danger, .badge.tone-error { color: var(--danger); }
.badge.tone-primary { color: var(--btn); }

.item.tone-muted .item-title, .item.tone-muted .item-text { color: var(--hint); }

.note.tone-muted { background: transparent; padding: 4px 6px; color: var(--hint); font-size: 13px; }

.note.tone-error .note-text, .note.tone-danger .note-text { color: var(--danger); }

/* ---------- buttons ---------- */

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.btn {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--section);
  color: var(--link);
  font-weight: 500;
  text-align: center;
}

.btn:active { opacity: 0.75; }

.btn:disabled { opacity: 0.5; }

.btn.tone-primary, .btn.primary { background: var(--btn); color: var(--btn-text); }

.btn.tone-danger, .btn.danger { background: var(--danger); color: #ffffff; }

.btn.tone-warn { color: var(--warn); }

.btn.tone-ok { color: var(--ok); }

.btn.tone-muted { color: var(--hint); }

.btn.wide { display: block; width: 100%; }

.btn.busy { position: relative; color: transparent; }

.btn.busy::after {
  content: "…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-weight: 700;
}

.btn.primary.busy::after, .btn.tone-primary.busy::after { color: var(--btn-text); }

.btn.danger.busy::after, .btn.tone-danger.busy::after { color: #ffffff; }

.btn.tone-ok.busy::after, .btn.tone-warn.busy::after, .btn.tone-muted.busy::after, .btn.busy:not(.primary):not(.danger):not(.tone-primary):not(.tone-danger)::after { color: var(--link); }

/* ---------- segments and pager ---------- */

.seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--tint);
}

.seg-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-btn.on { background: var(--section); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }

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

.pager .btn { flex: 1 1 0; }

.pager-info { flex: none; color: var(--hint); font-size: 13px; }

/* ---------- forms ---------- */

.search { display: flex; gap: 8px; padding: 8px; }

.search .input { flex: 1; min-width: 0; }

.search .btn { flex: none; }

.form { padding: 12px 14px 14px; border-left: 3px solid transparent; }

.field { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }

.field-label { display: block; padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 14px; }

.field-opt { color: var(--hint); font-weight: 400; }

.input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--sep);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

select.input {
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--hint) 50%), linear-gradient(135deg, var(--hint) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

textarea.input { min-height: 96px; resize: vertical; line-height: 1.4; }

.input:focus { border-color: var(--btn); outline: none; }

.input.bad, .choices.bad { border-color: var(--danger); }

.field-foot { display: flex; gap: 8px; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--hint); }

.field-hint { flex: 1; }

.counter { flex: none; }

.choices { display: block; border: 1px solid var(--sep); border-radius: 10px; overflow: hidden; background: var(--bg); }

.choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; cursor: pointer; }

.choice + .choice { border-top: 1px solid var(--sep); }

.choice input { flex: none; margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--btn); }

.choice-text { display: block; flex: 1; min-width: 0; }

.choice-l { display: block; }

.choice-hint { display: block; color: var(--hint); font-size: 12px; margin-top: 1px; }

.choice.dis { cursor: default; }

.choice.dis .choice-l { color: var(--hint); }

.field.note { padding: 10px 12px; border-radius: 10px; background: var(--tint); border-left: 3px solid transparent; }

.field.note .note-text { font-size: 14px; }

.form-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--tint); color: var(--danger); white-space: pre-wrap; }

/* ---------- fatal screen ---------- */

.fatal { margin: 40px 8px; padding: 20px 16px; border-radius: var(--radius); background: var(--section); text-align: center; }

.fatal-title { margin: 0 0 8px; font-size: 17px; }

.fatal-text { margin: 0 0 16px; white-space: pre-wrap; }

.fatal .actions { justify-content: center; margin: 0; }

/* ---------- tabs and toast ---------- */

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  height: calc(var(--tabs-h) + var(--safe-bottom));
  padding: 4px 4px var(--safe-bottom);
  background: var(--bg);
  border-top: 1px solid var(--sep);
}

body.typing .tabs { display: none; }

.tab {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--hint);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab.on { color: var(--btn); background: var(--tint); font-weight: 600; }

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 30;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(20, 22, 26, 0.92);
  color: #ffffff;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  white-space: pre-wrap;
  border-left: 4px solid transparent;
}

body.has-tabs .toast { bottom: calc(var(--tabs-h) + 12px + var(--safe-bottom)); }

body.typing .toast { bottom: calc(16px + var(--safe-bottom)); }

.toast.tone-ok { border-left-color: #4cc47a; }

.toast.tone-error { border-left-color: #ff6b6b; }

.toast.tone-warn { border-left-color: #e0a640; }

@media (prefers-reduced-motion: reduce) {
  .progress { animation: none; }
  .main { transition: none; }
}

/* Browser sign-in and personal support, using the same theme as the panel. */
.bot-link { color: var(--link); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.bot-link:focus-visible { outline: 2px solid var(--btn); outline-offset: 3px; }
.login-card, .own-intro, .own-card, .empty-own { max-width: 680px; margin: 24px auto; padding: 24px; background: var(--section); border: 1px solid var(--sep); border-radius: 12px; }
.login-card { max-width: 560px; margin-top: 40px; }
.login-kicker { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.login-title { margin: 8px 0 12px; font-size: 26px; line-height: 1.2; }
.login-lead, .login-help, .login-foot { color: var(--sub); line-height: 1.5; }
.login-lead { font-size: 15px; margin: 0 0 24px; }
.login-form, .appeal-form { display: grid; gap: 12px; }
.form-label { display: grid; gap: 8px; font-weight: 600; }
.login-input { width: 100%; min-height: 46px; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--sep); border-radius: 8px; }
.code-input { font-family: ui-monospace, Consolas, monospace; letter-spacing: .09em; text-transform: uppercase; }
.login-help, .login-foot { margin: 0; font-size: 14px; }
.login-foot { margin-top: 18px; }
.login-error { color: var(--danger); margin: 0; font-size: 14px; }
.login-error:empty { display: none; }
.own-intro { margin-bottom: 16px; }
.own-card { margin-top: 12px; margin-bottom: 12px; }
.own-title { margin: 0 0 6px; font-size: 18px; }
.own-duration, .own-meta { color: var(--sub); margin: 4px 0; }
.own-reason, .own-status { white-space: pre-wrap; margin: 12px 0; }
.own-status { color: var(--accent); font-weight: 600; }
.appeal-form { margin-top: 16px; }
.appeal-input { min-height: 130px; resize: vertical; }
.appeal-warning { padding: 12px; margin: 0; border-left: 3px solid var(--warn); background: var(--tint); }
@media (max-width: 480px) { .login-card, .own-intro, .own-card, .empty-own { padding: 16px; margin-top: 16px; } .bot-link { font-size: 12px; } }
@media (prefers-reduced-motion: reduce) { .progress { animation: none; } }

.login-bot { display: inline-block; margin-top: 16px; padding: 10px 0; color: var(--link); font-weight: 600; text-decoration: none; }
