/* Панель: та же палитра, что и витрина, но плотнее и без украшений. */

.admin { background: var(--bg); }

/* ─── вход ──────────────────────────────────────────────────────────────── */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login__card { width: min(400px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); }
.login__card h1 { font-size: 1.6rem; }
.login__hint { color: var(--muted); font-size: .8rem; line-height: 1.5; }
code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .07);
  font-size: .86em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ─── каркас панели ─────────────────────────────────────────────────────── */

.panel__top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.panel__top-inner { display: flex; align-items: center; gap: 20px; height: 62px; }
.panel__top-inner > strong { white-space: nowrap; }
.panel__top-actions { display: flex; gap: 8px; margin-left: auto; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.tabs button:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.tabs button.is-active { color: var(--text); background: rgba(255, 255, 255, .08); }

.badge {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #0b0c0e;
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
}

.panel__body { padding: 28px 0 80px; }
.pane__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.pane__head h2 { margin-right: auto; font-size: 1.4rem; }

/* ─── формы ─────────────────────────────────────────────────────────────── */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; font-size: .84rem; color: var(--muted); }
.field--wide { grid-column: 1 / -1; }
.field__hint { font-size: .76rem; opacity: .8; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row input, .row select { flex: 1; min-width: 200px; }

input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }
input[type="range"] { padding: 0; background: none; border: none; accent-color: var(--accent); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.upload { display: flex; align-items: center; gap: 10px; }
.upload__preview {
  width: 46px; height: 46px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft) center / cover no-repeat;
  flex: none;
}

/* ─── списки записей ────────────────────────────────────────────────────── */

.items { display: grid; gap: 10px; }

.item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.item.is-open { border-color: var(--line-strong); }
.item.is-hidden .item__title { opacity: .45; text-decoration: line-through; }

.item__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.item__head:hover { background: rgba(255, 255, 255, .03); }
.item__title { font-weight: 550; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__sub { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.item__move { display: flex; gap: 2px; }
.item__move button, .item__chevron {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .95rem;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.item__move button:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.item__body { display: none; padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.item.is-open .item__body { display: block; }
.item__form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; padding-top: 14px; }
.item__actions { display: flex; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.item__actions .danger { margin-left: auto; border-color: rgba(255, 92, 92, .35); color: #ff9b9b; }
.item__actions .danger:hover { background: rgba(255, 92, 92, .1); }

.empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ─── заявки ────────────────────────────────────────────────────────────── */

.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters button {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.filters button:hover { color: var(--text); }
.filters button.is-active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

.lead { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.lead__top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.lead__id { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.lead__name { font-weight: 600; }
.lead__date { color: var(--muted); font-size: .82rem; margin-left: auto; }
.lead__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 18px; margin-bottom: 10px; }
.lead__cell { font-size: .9rem; }
.lead__cell span { color: var(--muted); display: block; font-size: .78rem; }
.lead__message { white-space: pre-wrap; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-soft); font-size: .92rem; }
.lead__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.pill--new { background: var(--accent-soft); color: var(--accent); }
.pill--work { background: rgba(90, 140, 255, .16); color: #8fb0ff; }
.pill--done { background: rgba(69, 212, 131, .14); color: #6fdda4; }
.pill--spam { background: rgba(255, 92, 92, .14); color: #ff9b9b; }
.pill--src { background: rgba(255, 255, 255, .07); color: var(--muted); text-transform: none; letter-spacing: 0; }

/* ─── телеграм и данные ─────────────────────────────────────────────────── */

.tg-step { display: grid; gap: 12px; margin-bottom: 14px; }
.tg-step h3 { font-size: 1.05rem; }
.tg-step a { color: var(--accent); }
.tg-status { font-size: .88rem; color: var(--muted); min-height: 1.2em; }
.tg-status.ok { color: #6fdda4; }
.tg-status.err { color: #ff9b9b; }

.code-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-line code { padding: 9px 14px; font-size: .95rem; }

.btn input[type="file"] { display: none; }

/* ─── всплывашка ────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  padding: 12px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  font-size: .9rem;
  animation: pop .2s ease;
}
.toast.err { border-color: rgba(255, 92, 92, .4); color: #ff9b9b; }

@media (max-width: 760px) {
  .panel__top-inner { height: auto; flex-wrap: wrap; padding-block: 12px; gap: 12px; }
  .tabs { order: 3; width: 100%; }
  .panel__top-actions { margin-left: auto; }
}
