:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-muted: #f1f3f7;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;

  --primary: #2563eb;
  --primary-soft: #dbeafe;

  --ok: #16a34a;
  --warn: #dc2626;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

.site-header,
.site-footer {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.site-footer {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.header-inner,
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo a {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.site-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

/* ===== Search ===== */

.search-form {
  display: flex;
  gap: 8px;
  width: min(520px, 100%);
}

.search-form input[type="tel"] {
  flex: 1;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  outline: none;
}

.search-form input::placeholder {
  color: var(--muted);
}

.search-form button {
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.search-form button:hover {
  filter: brightness(0.95);
}

/* ===== Blocks ===== */

.home-hero,
.phone-hero,
.prefix-hero,
.tag-hero,
.search-hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.home-title,
.phone-title,
.prefix-title,
.tag-title,
.search-title {
  margin: 0 0 8px;
  font-size: 26px;
}

.home-subtitle,
.phone-subtitle,
.prefix-subtitle,
.tag-subtitle,
.search-subtitle {
  margin: 0;
  color: var(--muted);
}

.home-section,
.phone-stats,
.phone-reviews,
.phone-add-review,
.phone-similar,
.phone-faq,
.prefix-listing,
.prefix-info,
.tag-listing,
.tag-info,
.search-results,
.search-help {
  margin-top: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.section-title {
  margin: 0 0 14px;
  font-size: 18px;
}

/* ===== Badges ===== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--panel-muted);
  color: var(--text);
}

.badge-primary {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-ok {
  background: #dcfce7;
  color: var(--ok);
}

.badge-muted {
  color: var(--muted);
}

/* ===== Stats ===== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-muted);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

/* ===== Lists ===== */

.phone-list,
.prefix-list,
.tag-list,
.review-list,
.help-list,
.how-it-works {
  list-style: none;
  padding: 0;
  margin: 0;
}

.phone-list-item,
.prefix-list-item,
.tag-list-item,
.review-item {
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-muted);
  margin-bottom: 10px;
}

.phone-list-item a {
  font-weight: 600;
}

/* ===== Reviews ===== */

.review-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.review-rating {
  font-size: 13px;
  margin-bottom: 6px;
}

.review-text-muted,
.empty-text,
.hint-text {
  color: var(--muted);
}

/* ===== Forms ===== */

.review-form .form-row {
  margin-bottom: 14px;
}

.review-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.review-form select,
.review-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  outline: none;
}

/* ===== Footer ===== */

.footer-nav {
  display: flex;
  gap: 14px;
}

.footer-copy {
  font-size: 12px;
  color: var(--muted);
}

/* ===== Messages ===== */

.messages {
  max-width: 960px;
  margin: 12px auto 0;
  padding: 0 16px;
}

.message {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
}

/* ===== FAQ ===== */

.faq-item {
  margin-bottom: 14px;
}

.faq-q {
  margin: 0 0 6px;
  font-size: 14px;
}

.faq-a {
  color: var(--muted);
}

/* ===== Responsive ===== */

@media (max-width: 860px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.breadcrumbs {
  margin: 10px 0 16px;
}

.breadcrumbs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs-link {
  color: var(--muted);
}

.breadcrumbs-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.breadcrumbs-current {
  color: var(--text);
  font-weight: 600;
}

.breadcrumbs-sep {
  color: var(--border);
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  background: var(--tag-bg, #eee);
  color: var(--tag-color, #333);
}

/* fallback */
.tag.gray { background: #f0f0f0; color: #333; }
.tag.red { background: #fdecea; color: #c62828; }
.tag.darkred { background: #f8d7da; color: #842029; }
.tag.blue { background: #e3f2fd; color: #1565c0; }
.tag.green { background: #e8f5e9; color: #2e7d32; }
.tag.orange { background: #fff3e0; color: #ef6c00; }
.tag.purple { background: #f3e5f5; color: #6a1b9a; }

/* Универсальная сетка для листингов */
.grid-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.grid-list-item {
  list-style: none;
}

@media (max-width: 1200px) {
  .grid-list { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .grid-list { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .grid-list { grid-template-columns: repeat(2, 1fr); }
}


.review-form .form-row {
  margin: 12px 0;
}

.form-label {
  display: block;
  font-weight: 600;
  margin: 0 0 6px;
}

.review-form select,
.review-form textarea {
  width: 100%;
  max-width: 520px;
}

.stars {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* скрываем radio */
.star-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* рисуем звезду через label */
.star-label {
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: inline-block;
  background: currentColor;
  color: #e6e6e6;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* логика “закрашивания” без JS:
   рисуем справа налево, и закрашиваем все label справа от выбранного */
.stars {
  direction: rtl;
}

.star-label:hover,
.star-label:hover ~ .star-label {
  color: #f5c542;
}

.star-input:checked ~ .star-label {
  color: #f5c542;
}


.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.logo a {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.main-menu {
  display: flex;
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-menu a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  padding: 6px 0;
  position: relative;
}

.main-menu a:hover {
  color: var(--text);
}

.main-menu a.active {
  color: var(--text);
  font-weight: 600;
}

.main-menu a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* мобильная адаптация */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 8px;
  }

  .main-menu {
    flex-wrap: wrap;
    gap: 12px;
  }
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.rating-stars {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.rating-star {
  width: 18px;
  height: 18px;
  display: inline-block;
  background: currentColor;
  color: #e6e6e6;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.rating-star.is-filled {
  color: #f5c542;
}

.rating-meta {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  font-size: 13px;
  color: var(--muted);
}

.rating-text {
  color: var(--text);
  font-weight: 600;
}

.rating-count {
  color: var(--muted);
}

.rating-note {
  color: var(--muted);
}
