:root {
  --red: #ff4a26;
  --red-dark: #d84f37;
  --ink: #1b1b1b;
  --muted: #6f6f6f;
  --line: rgba(27, 27, 27, 0.1);
  --bg: #f4f4f5;
  --card: #ffffff;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3 {
  font-family: "PT Sans", sans-serif;
  margin: 0;
}

/* ---------- Кнопки / поля ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font: 600 14px Inter, sans-serif;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-dark); }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn--ghost:hover { background: rgba(0, 0, 0, 0.04); }
.btn--danger { background: #fdece9; color: #c0392b; }
.btn--danger:hover { background: #f8d7d1; }
.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field__input,
.field__textarea,
.field__select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: 400 15px Inter, sans-serif;
  color: var(--ink);
  background: #fff;
}
.field__textarea { min-height: 110px; resize: vertical; }
.field__input:focus,
.field__textarea:focus,
.field__select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 74, 38, 0.12);
}

/* ---------- Логин ---------- */
.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 30% 20%, #fff 0%, #f0e9e7 100%);
}
.login__card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 34px 30px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}
.login__brand {
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--red);
  font-size: 22px;
}
.login__title { font-size: 26px; margin-bottom: 6px; }
.login__error { margin: 0; color: #c0392b; font-size: 13px; }

/* ---------- Топбар ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar__brand { font-weight: 800; color: var(--red); letter-spacing: 0.02em; }
.topbar__tag {
  margin-left: 4px;
  font: 500 11px Inter, sans-serif;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ai-badge {
  width: 10px; height: 10px; border-radius: 50%;
  background: #c9c9c9;
}
.ai-badge.is-on { background: #35c759; }

.tabs { display: flex; gap: 6px; }
.tab {
  border: 0;
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
  font: 600 14px Inter, sans-serif;
  color: var(--muted);
  cursor: pointer;
}
.tab--active { background: var(--ink); color: #fff; }

/* ---------- Контент ---------- */
.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 26px 80px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-head h2 { font-size: 26px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card__media {
  aspect-ratio: 4 / 3;
  background: #ececec center / cover no-repeat;
}
.card__body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__title { font: 700 16px Inter, sans-serif; }
.card__meta { font-size: 13px; color: var(--muted); }
.card__price { font: 700 14px Inter, sans-serif; color: var(--red); }
.card__actions { display: flex; gap: 8px; margin-top: 10px; }

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

/* ---------- Модалка формы ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 20, 22, 0.45);
  backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal__card {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  padding: 26px;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal__head h3 { font-size: 22px; }
.modal__close { border: 0; background: transparent; font-size: 24px; cursor: pointer; color: var(--muted); }
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.weight-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }

.uploader { display: flex; align-items: center; gap: 12px; }
.uploader__preview {
  width: 72px; height: 72px; border-radius: 12px;
  background: #ececec center / cover no-repeat;
  flex: 0 0 auto;
}
.hint { font-size: 12px; color: var(--muted); }

.ai-row { display: flex; gap: 8px; align-items: center; }

/* ---------- Тост ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}
.toast.is-err { background: #c0392b; }

/* Просмотр диалога с ИИ */
.chat-log { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; margin-top: 12px; }
.chat-log__msg { padding: 10px 14px; border-radius: 14px; max-width: 85%; }
.chat-log__msg--user { align-self: flex-end; background: var(--ink); color: #fff; }
.chat-log__msg--assistant { align-self: flex-start; background: #f1f0ee; color: var(--ink); }
.chat-log__role { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.6; margin-bottom: 3px; }
.chat-log__text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .tabs { order: 3; width: 100%; flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; }
}
