/* Админка: та же тёмная тема, что у сайта, но плотнее — это рабочий инструмент */

:root {
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface-2: #1d1d22;
  --line: #2a2a31;
  --text: #ececef;
  --muted: #8b8b95;
  --accent: #f2d544;
  --accent-2: #e8792b;
  --ok: #3ba55d;
  --bad: #d9483a;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

/* Собственный display у блока сильнее атрибута hidden — возвращаем ему власть */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

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

/* ─── кнопки ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; padding: 0.6rem 1.1rem;
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 600; font-size: 0.9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: filter 0.2s, background 0.2s, border-color 0.2s;
}
.btn--primary { background: linear-gradient(100deg, var(--accent), var(--accent-2)); color: #14140f; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--muted); }
.btn--flat { background: none; color: var(--muted); padding: 0.6rem 0.7rem; }
.btn--flat:hover { color: var(--text); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.input {
  width: 100%; padding: 0.6rem 0.85rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  outline: none;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 4.5rem; line-height: 1.5; }

.field { display: block; margin-bottom: 0.9rem; }
.field__label { display: block; margin-bottom: 0.3rem; font-size: 0.82rem; color: var(--muted); }

/* ─── вход ─── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login__box {
  width: min(100%, 360px); padding: 1.8rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.login__brand { margin: 0 0 0.2rem; font-weight: 800; letter-spacing: 0.02em; }
.login__brand span { color: var(--accent); }
.login__title { margin: 0 0 1.4rem; font-size: 1.15rem; color: var(--muted); font-weight: 500; }
.login__box .btn { width: 100%; margin-top: 0.4rem; }
.login__error { margin: 0.9rem 0 0; color: var(--bad); font-size: 0.88rem; }

/* ─── шапка ─── */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 0.8rem clamp(0.9rem, 3vw, 2rem) 0.6rem;
}
.top__brand { margin: 0; font-weight: 800; }
.top__brand span { color: var(--accent); }
.top__actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.draft { font-size: 0.8rem; color: var(--accent); }

.tabs { display: flex; gap: 0.3rem; padding: 0 clamp(0.9rem, 3vw, 2rem); overflow-x: auto; }
.tab {
  padding: 0.6rem 0.9rem; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 0.9rem;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab.is-on { color: var(--text); border-bottom-color: var(--accent); }

.main { padding: 1.2rem clamp(0.9rem, 3vw, 2rem) 5rem; max-width: 1100px; margin: 0 auto; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 0 0 1.1rem; }
.hint b { color: var(--accent); font-weight: 600; }
.search { margin-bottom: 1.1rem; }
.list { display: grid; gap: 0.7rem; }

/* ─── товар ─── */
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item__head {
  display: flex; align-items: center; gap: 0.8rem; width: 100%;
  padding: 0.85rem 1rem; background: none; border: 0; cursor: pointer; text-align: left;
}
.item__thumb { width: 44px; height: 58px; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex: none; }
.item__name { font-weight: 600; }
.item__meta { font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }
.item__flag { margin-left: auto; font-size: 0.75rem; color: var(--accent); flex: none; }
.item__body { padding: 0 1rem 1.1rem; border-top: 1px solid var(--line); }

.variant { margin-top: 1.2rem; }
.variant__title { font-size: 0.82rem; color: var(--muted); font-family: var(--mono); margin: 0 0 0.5rem; }

/* ─── фото ─── */
.shots { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.shot {
  position: relative; width: 92px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
}
.shot.is-main { border-color: var(--accent); }
.shot.is-drag { opacity: 0.35; }
.shot.is-over { border-color: var(--accent); }
.shot img { width: 100%; height: 122px; object-fit: cover; display: block; cursor: grab; }
.shot__tag {
  position: absolute; top: 4px; left: 4px;
  padding: 0.1rem 0.4rem; border-radius: 999px;
  background: var(--accent); color: #14140f;
  font-size: 0.62rem; font-weight: 700;
}
.shot__bar { display: flex; border-top: 1px solid var(--line); }
.shot__bar button {
  flex: 1; padding: 0.28rem 0; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 0.85rem; line-height: 1;
}
.shot__bar button:hover { color: var(--text); background: var(--surface); }
.shot__bar button.danger:hover { color: var(--bad); }

.shot--add {
  display: grid; place-items: center; height: 145px; cursor: pointer;
  border-style: dashed; color: var(--muted); font-size: 0.78rem; text-align: center; padding: 0.5rem;
}
.shot--add:hover { color: var(--text); border-color: var(--muted); }
.shot--add input { display: none; }

.hidden-shots { margin-top: 0.7rem; font-size: 0.8rem; color: var(--muted); }
.hidden-shots button {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  font-size: 0.8rem; padding: 0; text-decoration: underline;
}

/* ─── тексты ─── */
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.group__title { margin: 0 0 0.9rem; font-size: 0.95rem; }
.group__title span { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.field--changed .field__label::after { content: " · изменено"; color: var(--accent); }

.sticky {
  position: sticky; bottom: 0; margin-top: 1rem; padding: 0.9rem 0;
  background: linear-gradient(transparent, var(--bg) 35%);
}

/* ─── версии ─── */
.version {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.8rem 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
}
.version__time { font-family: var(--mono); font-size: 0.85rem; }
.version__note { font-size: 0.78rem; color: var(--muted); }

/* ─── уведомление ─── */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  padding: 0.7rem 1.2rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 0.9rem; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.ok { border-color: var(--ok); }
.toast.bad { border-color: var(--bad); }

@media (max-width: 560px) {
  .top__actions .btn { padding: 0.5rem 0.8rem; font-size: 0.85rem; }
  .shot { width: calc(50% - 0.3rem); }
  .shot img { height: 150px; }
}
