:root {
  --bg: #0f1115;
  --card: #181b22;
  --card-off: #14171d;
  --border: #262a33;
  --text: #e8eaee;
  --text-off: #b8beca;
  --muted: #8b93a1;
  --accent: #2f6df6;
  --badge-bg: #2a2f3a;
  --badge-text: #9aa3b2;
  --error: #ff8a8a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
#app { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.noscript { padding: 24px 16px; text-align: center; color: var(--muted); }

/* Шапка */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.link-btn {
  background: none; border: 0; padding: 6px 4px; color: var(--muted);
  font: inherit; font-size: 14px; cursor: pointer;
}
.link-btn:hover { color: var(--text); }

/* Плитки */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.tile {
  display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 128px; padding: 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  color: inherit; text-decoration: none;
}
.tile-title { font-size: 17px; font-weight: 600; }
.tile-desc { font-size: 14px; color: var(--muted); }
.badge {
  align-self: flex-start; margin-top: auto; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--badge-bg); color: var(--badge-text);
}
.tile.live { border-color: var(--accent); }
.tile.live .badge { background: var(--accent); color: #fff; }
.tile.off { background: var(--card-off); }
.tile.off .tile-title { color: var(--text-off); }
@media (prefers-reduced-motion: no-preference) {
  .tile.live { transition: transform 0.15s ease, box-shadow 0.15s ease; }
  .tile.live:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(47, 109, 246, 0.18); }
}

/* Вход */
.center { min-height: 80vh; display: grid; place-items: center; }
.card {
  width: 100%; max-width: 360px; padding: 28px 24px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
}
.login { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input {
  padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.field input:focus { border-color: var(--accent); outline: none; }
.btn {
  padding: 11px 16px; font: inherit; font-weight: 600; color: #fff;
  background: var(--accent); border: 0; border-radius: 8px; cursor: pointer;
}
a.btn { display: inline-block; text-decoration: none; }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: 0.6; cursor: default; }
.form-error { min-height: 1.5em; font-size: 14px; color: var(--error); }


/* Публикатор: блоки страницы */
.topbar-right { display: flex; gap: 8px; align-items: center; }
.link-btn.as-link { text-decoration: none; }
.panel {
  padding: 18px; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.panel h2 { margin: 0; font-size: 16px; font-weight: 600; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.muted { color: var(--muted); font-size: 14px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--badge-bg); object-fit: cover; }
.btn.secondary { background: var(--badge-bg); color: var(--text); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.notice { padding: 10px 14px; border-radius: 8px; font-size: 14px; background: var(--badge-bg); }
.notice.error { color: var(--error); }
textarea {
  width: 100%; min-height: 110px; padding: 10px 12px; resize: vertical;
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
textarea:focus { border-color: var(--accent); outline: none; }

/* Очередь */
.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-off);
}
.item-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.item-title { font-size: 15px; overflow-wrap: anywhere; }
.item-url { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.item-error { font-size: 13px; color: var(--error); overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.status { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--badge-bg); color: var(--badge-text); }
.status.working { background: #3a3220; color: #f0c674; }
.status.sent { background: #1d3326; color: #7fd49b; }
.status.failed { background: #3a2023; color: var(--error); }

@media (max-width: 560px) {
  #app { padding-top: 16px; }
  .item { flex-direction: column; }
}

/* Добавление: описание, файлы */
.panel h3 { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--text-off); }
textarea.short { min-height: 64px; }
.drop {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center;
  padding: 22px 16px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg);
  text-align: center;
}
.drop.over { border-color: var(--accent); background: #131a2b; }
.item-desc { font-size: 13px; color: var(--text-off); white-space: pre-wrap; overflow-wrap: anywhere; }
