:root {
  --ink: #171717;
  --muted: #68605b;
  --line: #dfd8ce;
  --paper: #fffdf8;
  --surface: #ffffff;
  --accent: #146b58;
  --accent-2: #b9382f;
  --brand-red: #b9382f;
  --gold: #d9a441;
  --soft: #f2eadf;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }

.public-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(20,107,88,.12), transparent 40%),
    linear-gradient(315deg, rgba(185,56,47,.11), transparent 44%),
    var(--paper);
}
.guest-card {
  width: min(100%, 430px);
  min-height: min(650px, calc(100svh - 36px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 22px;
  background: rgba(255,255,255,.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(31, 24, 17, .11);
}
.guest-logo {
  width: auto;
  height: 82px;
  max-width: 34%;
  object-fit: contain;
  margin: 0 auto 24px;
  display: block;
}
.guest-section h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 9vw, 42px);
  line-height: 1.02;
  text-align: center;
}
.guest-section p {
  margin: 0 auto 28px;
  max-width: 330px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}
.stars {
  display: grid;
  justify-items: center;
  gap: 9px;
}
.stars button {
  min-height: 58px;
  width: fit-content;
  min-width: 64px;
  border: 1.5px solid rgba(185, 56, 47, .45);
  border-radius: 18px;
  color: var(--brand-red);
  background: var(--surface);
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(185, 56, 47, .08);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.stars button:hover,
.stars button:focus-visible {
  border-color: var(--brand-red);
  background: #fff5f3;
  outline: none;
}
.star-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.star-row svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill .14s ease, transform .14s ease;
}
.stars button:hover svg,
.stars button:focus-visible svg,
.stars button:active svg,
.stars button.is-filled svg {
  fill: currentColor;
}
.stars button:hover .star-row svg,
.stars button:focus-visible .star-row svg,
.stars button.is-filled .star-row svg {
  transform: scale(1.04);
}
.stars button:active { transform: translateY(1px); }
.button-stack {
  display: grid;
  gap: 12px;
}
.primary-button, .secondary-button, .guest-section button.primary-button {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}
.primary-button {
  color: white;
  background: var(--accent);
}
.secondary-button {
  color: white;
  background: var(--accent-2);
}
.yandex-button {
  background: var(--accent-2);
}
.twogis-button {
  background: var(--accent);
}
.feedback-form, .login-box, .admin-form {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}
.phone-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
}
textarea { resize: vertical; }
.hp { position: absolute; left: -9999px; }
.notice {
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 8px;
  color: #7a241d;
  background: #fff1ef;
  border: 1px solid #f0c7c2;
}
.compact { min-height: 300px; display: grid; place-items: center; }

.login-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--soft);
}
.login-box {
  width: min(100%, 380px);
  padding: 28px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.login-box img { width: 150px; }
.login-box h1 { margin: 8px 0 12px; }
.login-box button, .admin-form button, .inline-form button, .filters button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--accent);
  cursor: pointer;
}

.admin-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 250px 1fr;
  background: #f7f4ee;
}
.sidebar {
  min-height: 100svh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: white;
}
.admin-logo {
  width: 72px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 28px;
}
.sidebar nav { display: grid; gap: 8px; }
.sidebar a, .link-button {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
}
.sidebar a:hover, .link-button:hover { background: var(--soft); }
.link-button { margin-top: 18px; }
.admin-main { padding: 28px; min-width: 0; }
.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.admin-top h1 { margin: 0; font-size: 28px; }
.filters, .inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.filters > *, .inline-form > * { width: auto; min-width: 150px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.metrics article, .panel, .source-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.metrics span { display: block; color: var(--muted); }
.metrics strong { display: block; margin-top: 10px; font-size: 30px; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; background: #fbfaf7; }
.small-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 8px;
  color: white;
  text-decoration: none;
  background: var(--accent);
}
.details {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  margin: 0 0 22px;
}
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.source-card {
  display: grid;
  gap: 14px;
}
.source-card h2, .panel h2 { margin: 0 0 8px; font-size: 20px; }
.source-card p { margin: 0 0 10px; color: var(--muted); }
.source-card code {
  display: block;
  overflow-wrap: anywhere;
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
}
.qr {
  width: 168px;
  height: 168px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.compact-form { gap: 10px; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check input { width: auto; }
.button-row { display: flex; gap: 8px; }

@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-main { padding: 18px; }
  .admin-top { align-items: flex-start; flex-direction: column; }
  .details { grid-template-columns: 1fr; }
}
