/* qr-prxt — стили лендинга, кабинета и админки */

:root {
  --primary: #0f2137;
  --primary-light: #1a3a5c;
  --accent: #00a0e3;
  --accent-light: #38bdf8;
  --bg: #f0f4f8;
  --bg-subtle: #f8fafc;
  --white: #fff;
  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info-bg: #eff6ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(15, 33, 55, .06);
  --shadow-lg: 0 20px 60px rgba(15, 33, 55, .12);
  --transition: .2s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { color: var(--primary); line-height: 1.2; }
h1 { font-size: 1.85rem; margin: .2rem 0 1rem; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin: 1.5rem 0 .8rem; font-weight: 700; }
h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; font-weight: 600; }

.muted { color: var(--text-light); }
.small { font-size: .85rem; }
.center { text-align: center; }
.inline { display: inline; }

/* ─── Topbar ────────────────────────────────────────── */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--primary);
}
.brand-mark { font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.brand-sub  { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav a { color: var(--text); font-weight: 500; }

.link-btn {
  background: none;
  border: none;
  color: var(--text);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.link-btn:hover { color: var(--accent); }

.main { min-height: calc(100vh - 180px); padding: 24px; max-width: 1100px; margin: 0 auto; }

.footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: .85rem;
  color: var(--text-light);
}

/* ─── Кнопки ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: var(--white);
  box-shadow: 0 4px 14px rgba(0, 160, 227, .3);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(0, 160, 227, .4); }

.btn-outline {
  background: var(--white);
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 8px 16px; font-size: .9rem; }
.btn-block { width: 100%; }

/* ─── Hero / Главная ────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  border-radius: var(--radius);
  padding: 48px 32px;
  margin-bottom: 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.hero-inner { max-width: 700px; margin: 0 auto; }
.hero h1 {
  color: var(--white);
  font-size: 2.4rem;
  margin: 16px 0;
}
.hero-lead {
  font-size: 1.1rem;
  opacity: .9;
  margin-bottom: 16px;
}
.badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.how h2 { text-align: center; margin-bottom: 32px; }
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.step {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: var(--white);
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 16px;
}

/* ─── Карточки результата сканирования ─────────────── */
.card-wrap { max-width: 520px; margin: 32px auto; }
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border-top: 6px solid var(--accent);
}
.card.success { border-top-color: var(--success); }
.card.info    { border-top-color: var(--accent); }
.card.warn    { border-top-color: var(--warn); }
.card.danger  { border-top-color: var(--danger); }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 16px;
}
.success .card-icon { background: var(--success); }
.info    .card-icon { background: var(--accent); }
.warn    .card-icon { background: var(--warn); }
.danger  .card-icon { background: var(--danger); }

.card-lead { font-size: 1.05rem; margin: 12px 0 24px; }

.counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 24px 0;
}
.counter-val {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.counter-label { color: var(--text-light); font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }

.progress {
  height: 12px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}
.progress.big { height: 16px; margin: 16px 0; }
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 999px;
  transition: width .4s ease;
}
.progress-label { color: var(--text-light); font-size: .9rem; margin-bottom: 12px; }

/* ─── Формы ─────────────────────────────────────────── */
.form-wrap {
  max-width: 480px;
  margin: 32px auto;
  background: var(--white);
  padding: 36px 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .95rem; }
.form input[type="text"],
.form input[type="tel"],
.form input[type="password"],
.form input[type="month"],
.form-inline input[type="text"] {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
  transition: var(--transition);
}
.form input:focus, .form-inline input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 160, 227, .1);
}
.form .checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}
.form .checkbox input { width: 18px; height: 18px; cursor: pointer; }

.form-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.form-inline label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
.form-inline input { min-width: 200px; }

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.alert-error   { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: #047857; border: 1px solid #a7f3d0; }

/* ─── Кабинет ───────────────────────────────────────── */
.cabinet { max-width: 760px; margin: 0 auto; }
.cabinet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card.big { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: var(--white); }
.stat-card.big .stat-num { color: var(--white); }
.stat-card.big .stat-label { color: rgba(255, 255, 255, .8); }

.stat-num { font-size: 2.4rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label { color: var(--text-light); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.stat-sub { color: var(--text-muted); font-size: .8rem; margin-top: 4px; }

.info-block {
  background: var(--info-bg);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-top: 32px;
}
.info-block h3 { margin-top: 0; color: var(--primary); }
.info-block p { margin-bottom: 0; }

.scan-block {
  background: linear-gradient(135deg, rgba(0, 160, 227, .08), rgba(56, 189, 248, .12));
  border: 1px solid rgba(0, 160, 227, .2);
}
.scan-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  min-height: 20px;
  background: transparent;
  color: var(--text-light);
}
.scan-status:empty { display: none; }
.scan-status-error { background: var(--danger-bg); color: var(--danger); }

/* ─── Таблица ───────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 16px 0;
  font-size: .92rem;
}
.table thead { background: var(--bg-subtle); }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-weight: 600; color: var(--primary); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.table tr.blocked { background: var(--danger-bg); }
.table code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .85rem;
  font-family: 'SF Mono', Menlo, monospace;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tag-valid_first        { background: #ecfdf5; color: #047857; }
.tag-valid_already_mine { background: #fef3c7; color: #92400e; }
.tag-already_used_by_other { background: #fef2f2; color: #b91c1c; }
.tag-not_found          { background: #fef2f2; color: #b91c1c; }
.tag-disabled           { background: #f1f5f9; color: #475569; }
.tag-anon_valid         { background: #eff6ff; color: #1e40af; }
.tag-anon_used          { background: #f1f5f9; color: #475569; }

/* ─── Админка ───────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}
.admin-side {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 90px;
}
.admin-side-title {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.admin-side nav { display: flex; flex-direction: column; gap: 4px; }
.admin-side nav a {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
}
.admin-side nav a:hover { background: var(--bg); text-decoration: none; }

.admin-body { min-width: 0; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-head h1 { margin: 0; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.user-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.link-mini { font-size: .75rem; margin-left: 8px; }

/* ─── Prose / Policy ────────────────────────────────── */
.prose {
  max-width: 720px;
  margin: 0 auto;
  background: var(--white);
  padding: 36px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.prose h2 { margin-top: 24px; }
.prose ul { padding-left: 20px; }

/* ─── Адаптив ───────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 12px 16px; }
  .main { padding: 16px; }
  .hero { padding: 32px 20px; }
  .hero h1 { font-size: 1.8rem; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; }
  .admin-side nav { flex-direction: row; flex-wrap: wrap; }
  .table { font-size: .85rem; }
  .table th, .table td { padding: 10px 12px; }
}
