/* Админ-панель: просто и функционально */

:root {
  --red: #E8102E;
  --ink: #1a1a1c;
  --muted: #77717a;
  --line: #e5e2e6;
  --bg: #f5f4f6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* --- вход --- */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { font-size: 20px; }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; }

/* --- шапка --- */

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-actions { display: flex; gap: 16px; align-items: center; }

.wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 110px; }

/* --- вкладки --- */

.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs button {
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.tab { display: none; }
.tab.active { display: block; }

/* --- формы --- */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--red); }
input:disabled { background: var(--bg); color: var(--muted); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }

.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--red); }

/* --- кнопки --- */

.btn-red {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-red:hover { filter: brightness(0.92); }

.btn-plain {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--ink);
}
.btn-plain:hover { border-color: var(--ink); }

.btn-icon {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.btn-icon:hover { border-color: var(--ink); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); }

/* --- картинки --- */

.img-row { display: flex; gap: 14px; align-items: flex-start; }
.img-preview {
  width: 120px;
  min-width: 120px;
  height: 80px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-controls { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.img-btns { display: flex; gap: 8px; }

/* --- проекты --- */

.prj {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.prj-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}
.prj-head:hover { background: var(--bg); }
.prj-head .prj-name { font-weight: 600; flex: 1; }
.prj-head .prj-badge { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; }
.prj-head .prj-badge.on { color: var(--red); border-color: var(--red); }
.prj-controls { display: flex; gap: 6px; }

.prj-body { padding: 16px; border-top: 1px solid var(--line); display: none; }
.prj.open .prj-body { display: block; }

/* --- списки строк (статистика, ссылки) --- */

.row-item { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.row-item input, .row-item textarea { flex: 1; }

/* --- панель сохранения --- */

.savebar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  z-index: 10;
}

/* --- уведомление --- */

.toast {
  position: fixed;
  bottom: 70px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 20;
}
.toast.err { background: var(--red); }
