:root {
  --bg: #fcfafd; --card: #fff; --ink: #241f2e; --muted: #7a7387;
  --accent: #c2187a; --accent-dark: #9a1361; --line: #e7e2ee;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, "Segoe UI", sans-serif; color: var(--ink);
  /* фирменный фон: бесшовный SVG-паттерн «розовые бриллианты» (сетка со смещением) */
  background: var(--bg) url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='160'%20height='160'%3E%3Cdefs%3E%3Cg%20id='d'%20fill='none'%20stroke='%23d9a5c3'%20stroke-width='1.2'%3E%3Cpath%20d='M2%207L8%201h12l6%206-12%2014z'/%3E%3Cpath%20d='M2%207h24M8%201l3%206M20%201l-3%206M14%201l-3%206%203%2014M14%201l3%206-3%2014'/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href='%23d'%20x='18'%20y='18'%20opacity='.45'/%3E%3Cuse%20href='%23d'%20x='98'%20y='98'%20opacity='.22'/%3E%3C/svg%3E") repeat; }
main { max-width: 1200px; margin: 0 auto; padding: 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; } h2 { font-size: 17px; margin-top: 0; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.error { color: #b3261e; background: #fdeceb; padding: 8px 12px; border-radius: 8px; }

nav { display: flex; gap: 18px; align-items: center; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 20px; }
nav .brand { font-weight: 700; }
nav .spacer { flex: 1; }
.inline { display: inline; }
button.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { text-decoration: underline; }

.auth-card { max-width: 400px; margin: 8vh auto; background: var(--card); padding: 28px 32px; border-radius: 14px; box-shadow: 0 4px 24px rgba(36,31,46,.08); }
.auth-card h1 { margin-top: 0; font-size: 20px; }
.auth-card .qr img { width: 200px; height: 200px; }
label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 13px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
textarea { resize: vertical; }
button[type=submit] { margin-top: 12px; width: 100%; padding: 10px; background: var(--accent); color: #fff; border: none; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
button[type=submit]:hover { background: var(--accent-dark); }

.filters { display: flex; gap: 8px; margin: 14px 0; align-items: center; flex-wrap: wrap; }
.filters input[type=text], .filters input[type=email] { width: 280px; }
.filters select { width: auto; }
.filters button[type=submit] { width: auto; margin: 0; padding: 9px 18px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #faf8fc; }
tr:hover td { background: #fbf7fb; }
table.small td, table.small th { padding: 5px 8px; font-size: 12.5px; }
.actions form { margin-right: 8px; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12.5px; background: #eee; }
.tag-купил { background: #ddf3e1; color: #14652c; }
.tag-думает { background: #fdf3d7; color: #7a5b09; }
.tag-отказ { background: #fdeceb; color: #b3261e; }
.tag-нет_ответа { background: #eceaf1; color: #605a6e; }
.tag-не_определён { background: #e8eef8; color: #29497a; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border-radius: 12px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(36,31,46,.05); }
dl { display: grid; grid-template-columns: 150px 1fr; gap: 4px 10px; margin: 0; }
dt { color: var(--muted); } dd { margin: 0; }

.chat { max-height: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.msg.in { background: #f0edf5; align-self: flex-start; }
.msg.out { background: #fce7f2; align-self: flex-end; }
.msg .who { font-size: 12px; font-weight: 600; margin-bottom: 2px; }

.note { border-top: 1px solid var(--line); padding: 8px 0; white-space: pre-wrap; }

.barcell { width: 40%; }
progress.bar { width: 100%; height: 10px; appearance: none; -webkit-appearance: none; }
progress.bar::-webkit-progress-bar { background: #efeaf3; border-radius: 6px; }
progress.bar::-webkit-progress-value { background: var(--accent); border-radius: 6px; opacity: .8; }
progress.bar::-moz-progress-bar { background: var(--accent); border-radius: 6px; }
.product-block { margin-bottom: 16px; }
.product-block h2 { color: var(--accent-dark); border-bottom: 2px solid var(--line); padding-bottom: 6px; }
.funnel { background: #faf4f9; border-radius: 8px; padding: 8px 12px; font-weight: 600; }
.num { font-weight: 700; text-align: center; }
.recs { background: #f2f9f3; border-radius: 10px; padding: 12px 12px 12px 32px; margin: 8px 0 0; }
.recs li { margin: 4px 0; }
.pager { display: flex; gap: 14px; margin: 14px 0; align-items: center; }
