* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f7fa;
  color: #1a1a1a;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #1e293b; color: #fff; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.topbar .login-name { color: #cbd5e1; }
.role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.role-admin { background: #dc2626; color: #fff; }
.role-uploader { background: #2563eb; color: #fff; }
.role-evaluator { background: #16a34a; color: #fff; }

.container {
  flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 20px 16px;
}
.footer {
  text-align: center; font-size: 12px; color: #94a3b8;
  padding: 16px; border-top: 1px solid #e2e8f0;
}

h1 { font-size: 22px; margin: 0 0 16px; }
.muted { color: #64748b; font-size: 14px; }
.center { text-align: center; }

.card {
  background: #fff; border-radius: 10px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  margin-bottom: 16px;
}

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 14px; }
.form label em { font-style: normal; color: #dc2626; font-size: 12px; }
.form input {
  font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1;
  border-radius: 8px; background: #fff; width: 100%;
}
.form input:focus { outline: 2px solid #3b82f6; outline-offset: 1px; border-color: #3b82f6; }

.btn {
  font: inherit; padding: 10px 16px; border-radius: 8px; border: 0;
  cursor: pointer; font-weight: 600; text-decoration: none; display: inline-block;
  transition: background 0.15s;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; color: #cbd5e1; border: 1px solid #475569; }
.btn-ghost:hover { background: #334155; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.inline { display: inline; }

.alert {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px;
}
.alert-error { background: #fee2e2; color: #7f1d1d; }
.alert-info  { background: #dbeafe; color: #1e3a8a; }
.alert-ok    { background: #dcfce7; color: #14532d; }

/* === Кабинет загрузчика === */
h2 { font-size: 18px; margin: 0 0 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.row-between h2 { margin: 0; }
.btn-secondary { background: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
  background: #e2e8f0; color: #1e293b; font-size: 14px; font-weight: 500;
}
.tab.active { background: #2563eb; color: #fff; }

.album-filter { margin: 8px 0 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-block; padding: 4px 10px; background: #e2e8f0;
  color: #1e293b; border-radius: 999px; font-size: 13px; text-decoration: none;
}
.chip.active { background: #2563eb; color: #fff; }

.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.photo-tile {
  position: relative; display: block; aspect-ratio: 1/1;
  overflow: hidden; border-radius: 8px; background: #e2e8f0;
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.score-badge {
  position: absolute; bottom: 4px; left: 4px;
  padding: 2px 7px; border-radius: 6px; font-size: 12px;
  font-weight: 700; color: #fff;
}
.score-none { background: rgba(15,23,42,0.75); }
.score-1, .score-2, .score-3 { background: #dc2626; }
.score-4, .score-5 { background: #ea580c; }
.score-6, .score-7 { background: #ca8a04; }
.score-8, .score-9 { background: #16a34a; }
.score-10 { background: #15803d; }
.album-badge {
  position: absolute; top: 4px; right: 4px;
  background: rgba(15,23,42,0.75); color: #fff; padding: 2px 7px;
  border-radius: 6px; font-size: 11px;
}

.photo-full {
  max-width: 100%; max-height: 70vh; display: block; margin: 0 auto;
  border-radius: 8px;
}
.score-big {
  display: inline-block; padding: 8px 16px; border-radius: 8px;
  font-size: 24px; font-weight: 700; color: #fff;
}

.form-inline { flex-direction: row; align-items: center; gap: 8px; }
.form-inline input[type=text] { flex: 1; }

.album-list { list-style: none; padding: 0; margin: 12px 0 0; }
.album-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #e2e8f0;
}

/* === Кабинет оценщика === */
.hidden { display: none !important; }
.day-header { font-size: 15px; margin: 0 0 10px; font-weight: 600; }

.score-picker {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px;
  margin-top: 6px;
}
.score-radio { display: block; cursor: pointer; }
.score-radio input { display: none; }
.score-radio span {
  display: block; text-align: center; padding: 10px 0;
  background: #e2e8f0; color: #1e293b; border-radius: 8px;
  font-weight: 600; font-size: 14px; transition: background 0.12s;
}
.score-radio input:checked + span { background: #2563eb; color: #fff; }
.score-radio:hover span { background: #cbd5e1; }

.form textarea {
  font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1;
  border-radius: 8px; resize: vertical; width: 100%; min-height: 70px;
}
.form textarea:focus { outline: 2px solid #3b82f6; outline-offset: 1px; border-color: #3b82f6; }

/* === Админ-панель === */
.admin-user { padding: 14px 0; border-bottom: 1px solid #e2e8f0; }
.admin-user:last-child { border-bottom: none; }
.admin-user h3 {
  margin: 0 0 8px; font-size: 15px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.tag-ok { background: #dcfce7; color: #14532d; }
.tag-warn { background: #fef3c7; color: #78350f; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.btn-row form { display: inline; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* === Навигация по фото (оценщик) === */
.photo-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.photo-nav-buttons { display: flex; gap: 6px; margin-left: auto; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* === Кнопки оценки (0-10) === */
.score-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.score-btn {
  padding: 14px 0; border: 0; border-radius: 8px; cursor: pointer;
  background: #e2e8f0; color: #1e293b; font-weight: 700; font-size: 15px;
  transition: background 0.12s; font-family: inherit; width: 100%;
}
.score-btn:hover { background: #cbd5e1; }
.score-btn.checked { background: #2563eb; color: #fff; }
.score-btn.score-zero { background: #fee2e2; color: #7f1d1d; }
.score-btn.score-zero:hover { background: #fecaca; }

/* === Бейдж «есть комментарий» === */
.comment-badge {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(15,23,42,0.85); color: #fff;
  padding: 2px 6px; border-radius: 6px;
  font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px;
}
