:root {
  --bg: #121116;
  --surface: #1b1a21;
  --surface-2: #24222c;
  --line: #2f2d38;
  --text: #f3f2f5;
  --muted: #9b98a6;
  --accent: #b9a3ff;
  --accent-ink: #17141f;
  --ok: #6fd3a1;
  --warn: #f2c46d;
  --err: #ff8a8a;
  --telegram: #2aabee;
  --instagram: linear-gradient(90deg, #f58529, #dd2a7b 50%, #8134af);
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* A `display` in a class would otherwise override the hidden attribute. */
[hidden] { display: none !important; }
.wrap > *, .screen > * { min-width: 0; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 'Geologica', system-ui, sans-serif;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand em { font-style: normal; color: var(--muted); font-weight: 400; }
.logo { width: 32px; height: 32px; border-radius: 9px; display: block; }
.env { color: var(--muted); font-size: 13px; }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: grid;
  gap: 16px;
}
.screen { display: grid; gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
h1 { font-size: 24px; margin: 0 0 6px; font-weight: 600; }
h2 { font-size: 18px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 2px; font-weight: 600; }
.muted { color: var(--muted); margin: 0 0 12px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; min-height: 1em; }

.hero { padding: 32px 24px; text-align: center; }
.login-buttons { display: grid; gap: 12px; justify-items: center; margin-top: 20px; }
.google-slot { min-height: 44px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px;
  padding: 11px 18px; font: inherit; font-weight: 500;
  cursor: pointer; color: var(--text); background: var(--surface-2);
  transition: filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.telegram { background: var(--telegram); color: #fff; }
.btn.instagram { background: var(--instagram); color: #fff; }
#btn-telegram { min-width: 260px; }

.profile { display: flex; align-items: center; gap: 14px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar.placeholder {
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent); font-weight: 600; font-size: 18px;
}
.who { flex: 1; min-width: 0; }
.who .name { font-weight: 600; font-size: 17px; }
.who .muted { margin: 0; font-size: 13px; }

.badge { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.grow { flex: 1; min-width: 180px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; width: 100%;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }

.steps { margin: 14px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.steps li.ok { color: var(--ok); }
.steps li.err { color: var(--err); }
.steps li.run { color: var(--accent); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-all; }

.channels { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.channels li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.channels .type { font-weight: 500; }
.channels a { color: var(--accent); }
.channels .empty { color: var(--muted); justify-content: center; }

.channel-actions { display: grid; gap: 12px; }
.action { border-top: 1px solid var(--line); padding-top: 14px; }
.action .muted { font-size: 13px; margin-bottom: 10px; }
.action .row { margin: 0; }

.toast {
  border-radius: 12px; padding: 12px 16px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.toast.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.toast.err { border-color: color-mix(in srgb, var(--err) 60%, transparent); color: var(--err); }

.log summary { cursor: pointer; font-weight: 500; }
.log ol { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: 13px; }
.log li { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.log .line { display: flex; gap: 8px; align-items: baseline; }
.log .m { font-weight: 600; width: 52px; }
.log .s { margin-left: auto; font-weight: 600; }
.log .s.ok { color: var(--ok); }
.log .s.err { color: var(--err); }
.log pre {
  margin: 6px 0 0; white-space: pre-wrap; word-break: break-all;
  color: var(--muted); font-size: 12px; max-height: 200px; overflow: auto;
}

@media (max-width: 520px) {
  .profile { flex-wrap: wrap; }
  .facts { grid-template-columns: 1fr; }
  .facts dt { margin-top: 6px; }
  #btn-telegram { min-width: 0; width: 100%; }
}
