:root {
  --bg: #F1F5F9;
  --card: #fff;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --accent: #0F766E;
  --accent-hover: #0D9488;
  --navy: #0B1F36;
  --danger: #DC2626;
  --ok: #047857;
  --font-h: "Lexend", system-ui, sans-serif;
  --font-b: "Source Sans 3", system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(15, 39, 68, 0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-b);
  background: linear-gradient(180deg, #E8EEF5 0%, var(--bg) 40%);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
button, .btn { cursor: pointer; }

/* Public auth pages (login/register) */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.9rem 1.25rem; background: var(--navy); color: #fff;
}
.top a { color: #d7e8ff; margin-left: 0.85rem; }
.brand { font-weight: 700; color: #fff !important; margin-left: 0 !important; font-family: var(--font-h); }
.wrap { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
h1, h2, h3 { margin-top: 0; font-family: var(--font-h); letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
label { display: block; font-size: 0.9rem; margin: 0.75rem 0 0.3rem; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=search], textarea, select {
  width: 100%; padding: 0.65rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 0.65rem 1rem;
  background: var(--accent); color: #fff; font: inherit; font-family: var(--font-h); font-weight: 600;
}
.btn.secondary { background: #325574; }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.grid-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.4rem; }
.error, .ok {
  padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 1rem;
}
.error { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; }
.ok { background: #ECFDF5; color: var(--ok); border: 1px solid #A7F3D0; }
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; background: #E8EEF5; font-size: 0.75rem; font-weight: 600;
}
.badge.pending { background: #FEF3C7; color: #92400E; }
.badge.approved { background: #D1FAE5; color: #065F46; }
.badge.rejected, .badge.blocked { background: #FEE2E2; color: #991B1B; }
.avatar {
  width: 56px; height: 56px; object-fit: cover; border-radius: 12px; background: #E8EEF5; display: block;
}
.avatar.lg { width: 96px; height: 96px; }
.avatar-empty { width: 56px; height: 56px; border-radius: 12px; background: #E2E8F0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.thumbs figure { margin: 0; width: 120px; }
.thumbs img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; display: block; }
.check-line { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }

/* Admin shell */
.admin-body { background: #EEF2F7; }
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-sidebar {
  background: var(--navy); color: #E2E8F0; padding: 20px 16px; display: flex; flex-direction: column; gap: 20px;
}
.admin-brand {
  display: flex; gap: 12px; align-items: center; color: #fff !important; text-decoration: none !important;
}
.admin-brand-mark {
  width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: grid; place-items: center;
  font-family: var(--font-h); font-weight: 700;
}
.admin-brand strong { display: block; font-family: var(--font-h); }
.admin-brand small { color: #94A3B8; }
.admin-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.admin-nav-link {
  color: #CBD5E1 !important; text-decoration: none !important; padding: 10px 12px; border-radius: 10px;
  font-family: var(--font-h); font-weight: 500; font-size: 0.95rem;
}
.admin-nav-link:hover, .admin-nav-link.is-active { background: rgba(255,255,255,0.08); color: #fff !important; }
.admin-sidebar-foot { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 12px; font-size: 0.85rem; }
.admin-sidebar-foot a { color: #99F6E4 !important; }
.admin-main { padding: 24px 28px 48px; max-width: 1280px; }
.admin-page-head {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px;
}
.admin-page-head h1 { margin: 0 0 6px; font-size: 1.7rem; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px;
}
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.stat-label { margin: 0; color: var(--muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { margin: 4px 0 0; font-family: var(--font-h); font-size: 1.6rem; font-weight: 700; }
.filter-bar {
  display: grid; grid-template-columns: 1.4fr 1fr 0.8fr auto; gap: 8px; margin-bottom: 14px;
}
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td {
  text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.92rem;
}
.data-table th {
  background: #F8FAFC; font-family: var(--font-h); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.masters-table tr:hover td { background: #F8FAFC; }
.chip {
  display: inline-block; margin: 2px 2px 0 0; padding: 2px 8px; border-radius: 999px; background: #ECFDF5; color: #065F46; font-size: 0.75rem;
}
.offer-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 14px 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.96)),
    radial-gradient(120% 80% at 100% 0%, rgba(15,118,110,0.06), transparent 55%);
}
.offer-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.offer-block h3 { margin: 0; font-size: 1rem; }
.offer-empty { margin: 0; }
.upload-panel {
  margin-top: 20px;
  border: 1px solid #CBD5E1;
  border-radius: 16px;
  background:
    linear-gradient(145deg, #0B1F36 0%, #12324F 48%, #0F766E 140%);
  color: #E2E8F0;
  padding: 18px;
  box-shadow: 0 14px 34px rgba(11, 31, 54, 0.18);
  max-width: 860px;
}
.upload-panel-head h3 {
  margin: 0 0 4px;
  color: #fff;
  font-size: 1.05rem;
}
.upload-panel-head p {
  margin: 0 0 14px;
  color: #94A3B8;
  font-size: 0.92rem;
}
.upload-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
}
.upload-field label { color: #CBD5E1; margin-top: 0; }
.select-wrap select {
  background: rgba(255,255,255,0.96);
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(148,163,184,0.35);
}
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 118px;
  padding: 16px;
  border-radius: 12px;
  border: 1.5px dashed rgba(153, 246, 228, 0.55);
  background: rgba(15, 23, 42, 0.28);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
  font-weight: 500 !important;
}
.file-drop:hover, .file-drop.is-drag {
  border-color: #99F6E4;
  background: rgba(15, 118, 110, 0.22);
  transform: translateY(-1px);
}
.file-drop.has-files {
  border-style: solid;
  border-color: #5EEAD4;
}
.file-drop input[type=file] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.file-drop-title {
  color: #F8FAFC;
  font-family: var(--font-h);
  font-weight: 600;
  font-size: 0.98rem;
}
.file-drop-sub {
  color: #94A3B8;
  font-size: 0.82rem;
  line-height: 1.35;
}
.file-drop-names {
  margin-top: 8px;
  color: #99F6E4;
  font-size: 0.85rem;
  font-weight: 600;
}
.upload-panel-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-start;
}
.upload-panel .btn {
  background: #F8FAFC;
  color: #0B1F36;
}
.upload-panel .btn:hover { background: #fff; }
.avatar-upload-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.upload-inline { display: flex; flex-direction: column; gap: 8px; max-width: 280px; }
.thumb-card {
  margin: 0;
  width: 148px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  padding: 0 0 8px;
  box-shadow: 0 6px 16px rgba(15, 39, 68, 0.05);
  transition: transform .15s ease, box-shadow .15s ease;
}
.thumb-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 39, 68, 0.1);
}
.thumb-view {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.thumbs { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.thumbs img, .thumb-view img {
  width: 148px;
  height: 112px;
  object-fit: cover;
  display: block;
  background: #E2E8F0;
}
.btn-tiny {
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
  margin: 0 8px;
  width: calc(100% - 16px);
}
.btn-tiny:disabled { opacity: 0.6; cursor: wait; }
.avatar.lg, .avatar-empty.lg { width: 96px; height: 96px; }
.danger-zone {
  border-color: #FECACA;
  background: linear-gradient(180deg, #FFF7F7 0%, #fff 50%);
}
.danger-list {
  margin: 8px 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.danger-list strong { color: var(--ink); }
.admin-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(11, 31, 54, 0.88);
  display: grid;
  place-items: center;
  padding: 24px;
}
.admin-lightbox[hidden] { display: none !important; }
.admin-lightbox img {
  max-width: min(960px, 94vw);
  max-height: 88vh;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.admin-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.admin-edit-grid { display: grid; gap: 14px; }

/* Сниппет прогресса загрузки — один вид на мобиле и десктопе */
.upload-progress-snip {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  z-index: 1100;
  pointer-events: none;
}
.upload-progress-snip[hidden] { display: none !important; }
.upload-progress-snip-inner {
  pointer-events: auto;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(11, 31, 54, 0.96);
  color: #E2E8F0;
  box-shadow: 0 16px 40px rgba(11, 31, 54, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.28);
  backdrop-filter: blur(8px);
}
.upload-progress-snip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.upload-progress-snip-title {
  font-family: var(--font-h);
  font-weight: 600;
  font-size: 0.95rem;
  color: #F8FAFC;
}
.upload-progress-snip-pct {
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  font-weight: 700;
  color: #5EEAD4;
  letter-spacing: -0.02em;
}
.upload-progress-snip-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}
.upload-progress-snip-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0F766E, #2DD4BF);
  transition: width 0.12s linear;
}
.upload-progress-snip-meta {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #94A3B8;
  line-height: 1.35;
}
.upload-progress-snip.is-done .upload-progress-snip-pct { color: #6EE7B7; }
.upload-progress-snip.is-done .upload-progress-snip-bar {
  background: linear-gradient(90deg, #047857, #34D399);
}
.upload-progress-snip.is-error .upload-progress-snip-pct { color: #FCA5A5; }
.upload-progress-snip.is-error .upload-progress-snip-bar {
  background: #DC2626;
}

@media (max-width: 720px) {
  .upload-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
}
