:root {
  --bg: #ffffff;
  --bg-soft: #f7f5f2;
  --text: #1f231f;
  --text-muted: #5c6259;
  --accent: #a3703f;
  --accent-dark: #8a5a30;
  --line: #e6e2db;
  --dark: #23271f;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(20, 24, 20, 0.08);
  --max-width: 1160px;
  --admin-header-size: 60px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; text-decoration: none; }

.section-title {
  font-size: clamp(24px, 3vw, 34px);
  margin: 0 0 32px;
  text-align: center;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--line); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-small { padding: 9px 18px; font-size: 14px; }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
}
.logo {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .3px;
  white-space: nowrap;
}
.logo span { color: var(--accent); }
.logo--light { color: #fff; }
.main-nav { display: flex; gap: clamp(14px, 2vw, 28px); flex: 1; min-width: 0; align-items: center; justify-content: center; }
.main-nav a { color: var(--text-muted); font-size: 15px; }
.main-nav a:hover { color: var(--accent); }
.main-nav a.main-nav__all { color: var(--text); font-weight: 600; }
.main-nav a.is-active { color: var(--accent); }
.mobile-nav { display: none; }

/* ---------- All projects page ---------- */

.projects-page { padding: 32px 24px 72px; }
.projects-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}
.projects-head h1 { margin: 0 0 4px; font-size: clamp(28px, 4vw, 40px); }
.projects-count { margin: 0; color: var(--text-muted); }
.projects-sort { display: flex; flex-wrap: wrap; gap: 8px; }
.sort-chip {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-muted);
  transition: border-color .15s ease, color .15s ease;
}
.sort-chip:hover { border-color: var(--accent); color: var(--accent); }
.sort-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.houses-more { text-align: center; margin-top: 40px; }

/* ---------- Portfolio ---------- */

.portfolio-card .house-card__image { position: relative; }
.portfolio-card__count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20, 24, 20, 0.65);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.portfolio-card__address { color: var(--text-muted); font-size: 14px; margin: 0 0 18px; }
.portfolio-card__address::before { content: "📍 "; }

.portfolio-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  margin-bottom: 56px;
}
.portfolio-detail__info h1 { font-size: clamp(26px, 3.5vw, 38px); margin: 0 0 14px; }
.portfolio-detail__address { margin: 0 0 20px; font-size: 16px; }
.portfolio-detail__address::before { content: "📍 "; }
.portfolio-detail__address a { display: inline-block; margin-left: 6px; color: var(--accent); font-size: 14px; font-weight: 600; }
.portfolio-detail__address a:hover { color: var(--accent-dark); }
.portfolio-detail__description { white-space: pre-line; margin-bottom: 0; }
.portfolio-map {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  aspect-ratio: 4 / 3;
}
.portfolio-map iframe { width: 100%; height: 100%; border: 0; display: block; }

@media (max-width: 900px) {
  .portfolio-detail { grid-template-columns: 1fr; }
}

/* ---------- Construction stages: лента слева + общий блок справа ---------- */

.stages-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item { position: relative; }
/* Соединительная линия между кружками */
.timeline__item::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 34px;
  bottom: -10px;
  width: 2px;
  background: var(--line);
}
.timeline__item:last-child::before { display: none; }
.timeline__btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 6px 10px 6px 0;
  margin: 2px 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: 999px;
}
.timeline__btn:hover .timeline__title { color: var(--accent); }
.timeline__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.timeline__dot {
  position: relative;
  z-index: 1;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.timeline__title { flex: 1; font-size: 15px; line-height: 1.35; transition: color .15s ease; }
.timeline__badge { flex: none; font-size: 12px; color: var(--text-muted); }
.timeline__btn.is-active .timeline__dot { background: var(--accent); color: #fff; transform: scale(1.08); }
.timeline__btn.is-active .timeline__title { font-weight: 700; color: var(--accent-dark); }

.stage-panel {
  position: sticky;
  top: 90px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 28px;
  min-height: 320px;
}
.stage-panel__step { font-size: 13px; font-weight: 600; color: var(--accent-dark); text-transform: uppercase; letter-spacing: .5px; }
.stage-panel__title { margin: 6px 0 12px; font-size: clamp(22px, 2.6vw, 30px); }
.stage-panel__text { margin: 0 0 20px; color: var(--text-muted); font-size: 16px; line-height: 1.7; white-space: pre-line; }
.stage-panel__empty { margin: 0 0 20px; color: var(--text-muted); font-style: italic; }
.stage-panel__photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.stage-panel__photo {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
  aspect-ratio: 4 / 3;
}
.stage-panel__photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.stage-panel__photo:hover img { transform: scale(1.04); }
.stage-panel__nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.stage-panel__nav .btn[hidden] { display: none; }

@media (max-width: 900px) {
  .stages-layout { grid-template-columns: 1fr; gap: 24px; }
  .stage-panel { position: static; padding: 20px; scroll-margin-top: 16px; }
  .stage-panel__photos { grid-template-columns: repeat(2, 1fr); }
}

/* Админка: этапы стройки — раскрывающийся список */
.admin-stages-hint { margin: -12px 0 20px; }
.admin-stages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 32px; }
.admin-stage { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.admin-stage[open] { box-shadow: var(--shadow); }
.admin-stage__summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}
.admin-stage__summary::-webkit-details-marker { display: none; }
.admin-stage__summary::after { content: "▾"; color: var(--text-muted); margin-left: 4px; transition: transform .15s ease; }
.admin-stage[open] > .admin-stage__summary::after { transform: rotate(180deg); }
.admin-stage__num {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-stage__title { flex: 1; font-weight: 600; min-width: 0; }
.admin-stage__count { font-size: 13px; color: var(--accent-dark); font-weight: 600; white-space: nowrap; }
.admin-stage__count.is-empty { color: var(--text-muted); font-weight: 400; }
.admin-stage__body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.admin-stage__toolbar { display: flex; gap: 8px; margin: 12px 0; }
.admin-stage__toolbar button:disabled { opacity: .4; cursor: default; transform: none; }

/* Админка: обложка и кнопки у фото портфолио */
.admin-gallery-item.is-cover img { border: 2px solid var(--accent); }
.admin-cover-badge { font-size: 12px; font-weight: 600; color: var(--accent); text-align: center; padding: 6px 0; }
.admin-gallery-item .btn-small { width: 100%; padding: 6px 8px; font-size: 12px; }
.admin-map-check { color: var(--accent); font-weight: 600; margin-left: 4px; }
.admin-form-actions { gap: 10px; align-items: center; }
.projects-empty { color: var(--text-muted); padding: 40px 0; text-align: center; }
.phone { font-weight: 600; white-space: nowrap; }
.phone:hover { color: var(--accent); }

/* ---------- Hero ---------- */

.hero {
  background-size: cover;
  background-position: center;
  color: #fff;
  min-height: 560px;
  display: flex;
  align-items: center;
}
.hero-inner { max-width: 720px; padding-top: 40px; padding-bottom: 40px; }
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  margin: 0 0 18px;
  line-height: 1.15;
}
.hero-subtitle {
  font-size: 18px;
  opacity: .92;
  margin: 0 0 32px;
  max-width: 560px;
}

/* ---------- Intro ---------- */

.intro { padding: 56px 24px; max-width: 820px; margin: 0 auto; }
.intro p { font-size: 18px; color: var(--text-muted); text-align: center; }

/* ---------- Advantages ---------- */

.advantages { background: var(--bg-soft); padding: 64px 0; }
.advantages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 28px;
}
.advantage-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: var(--shadow);
}
.advantage-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  margin-bottom: 14px;
}
.advantage-num {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.advantage-card h3 { margin: 0 0 8px; font-size: 18px; }
.advantage-card p { margin: 0; color: var(--text-muted); font-size: 15px; }

/* ---------- Houses ---------- */

.houses { padding: 64px 0; }
.houses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}
.house-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  transition: box-shadow .2s ease, transform .2s ease;
}
.house-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.house-card__image {
  display: block;
  height: 190px;
  background-size: cover;
  background-position: center;
}
.house-card__body { padding: 20px; }
.house-card__body h3 { margin: 0 0 8px; font-size: 19px; }
.house-card__title-link:hover { color: var(--accent); }
.house-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--accent-dark);
  font-weight: 600;
  margin-bottom: 12px;
}
.house-card__body p { color: var(--text-muted); font-size: 14px; margin: 0 0 18px; min-height: 60px; }

/* ---------- CTA / form ---------- */

.cta { background: var(--dark); color: #fff; padding: 64px 0; position: relative; }
.cta-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
  justify-content: space-between;
}
.cta-text { max-width: 440px; }
.cta-text h2 { margin: 0 0 12px; font-size: 28px; }
.cta-text p { color: rgba(255,255,255,.7); margin: 0; }
.cta-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 340px;
}
.cta-form input {
  padding: 13px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-size: 15px;
}
.cta-form input::placeholder { color: rgba(255,255,255,.5); }
.cta-form__note { font-size: 12px; color: rgba(255,255,255,.5); margin: 0; }
.cta-form__hint { font-size: 12px; color: rgba(255,255,255,.55); margin: -4px 0 0; }
.cta-form__hint.is-error { color: #ff8a80; font-weight: 600; }

.field-invalid { border-color: #ff8a80 !important; }
.side-form input.field-invalid,
.login-form input.field-invalid { border-color: #d32f2f !important; }

.toast--error { background: #c0392b; }

.toast {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #2e7d32;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
}

/* ---------- Footer ---------- */

.site-footer { background: var(--dark); color: rgba(255,255,255,.8); padding-top: 48px; }
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer-text { color: rgba(255,255,255,.55); font-size: 14px; margin-top: 12px; max-width: 260px; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col h4 { margin: 0 0 4px; font-size: 15px; color: #fff; }
.footer-col a, .footer-col span { color: rgba(255,255,255,.65); font-size: 14px; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  font-size: 13px;
  color: rgba(255,255,255,.45);
  flex-wrap: wrap;
  gap: 10px;
}
.footer-admin-link { color: rgba(255,255,255,.45); }
.footer-admin-link:hover { color: var(--accent); }

/* ---------- House detail page ---------- */

.not-found { padding: 80px 24px; text-align: center; }
.not-found h1 { margin-bottom: 12px; }
.not-found p { color: var(--text-muted); margin-bottom: 24px; }

.house-detail { padding: 32px 24px 72px; }

.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 6px; }

.house-detail-gallery { margin-bottom: 40px; }
.gallery-main {
  position: relative;
  display: block;
  width: 100%;
  height: 440px;
  border: none;
  padding: 0;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  background-color: var(--bg-soft);
  cursor: zoom-in;
}
.gallery-zoom-hint {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 24, 20, 0.6);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .15s ease;
}
.gallery-main:hover .gallery-zoom-hint,
.gallery-main:focus-visible .gallery-zoom-hint { opacity: 1; }
.gallery-thumbs { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.gallery-thumb {
  width: 96px;
  height: 68px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: none;
  opacity: .7;
  transition: opacity .15s ease, border-color .15s ease;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb:hover { opacity: 1; }
.gallery-thumb.is-active { opacity: 1; border-color: var(--accent); }

.house-detail-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  align-items: start;
}
.house-detail-main h1 { font-size: clamp(26px, 3.5vw, 38px); margin: 0 0 14px; }
.house-detail-meta { display: flex; gap: 20px; margin-bottom: 20px; }
.house-detail-price { font-weight: 700; color: var(--accent-dark); font-size: 20px; }
.house-detail-area { font-weight: 600; color: var(--text-muted); font-size: 20px; }
.house-detail-description { color: var(--text-muted); font-size: 16px; line-height: 1.7; margin-bottom: 36px; }

.section-title--left { text-align: left; font-size: 22px; margin-bottom: 20px; }

.specs-table { margin: 0; display: flex; flex-direction: column; }
.specs-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.specs-row dt { color: var(--text-muted); margin: 0; }
.specs-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 600; text-align: right; }

.house-detail-side { position: sticky; top: 90px; }
.house-detail-card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 24px;
}
.house-detail-card h3 { margin: 0 0 8px; font-size: 18px; }
.house-detail-card p { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; }
.side-form { display: flex; flex-direction: column; gap: 12px; }
.side-form input {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14px;
  background: #fff;
}
.side-form__success { margin-top: 14px; color: #1e7d32; font-size: 14px; }
.side-form__error { margin-top: 14px; color: #c0392b; font-size: 14px; }
.side-form__hint { color: var(--text-muted); margin: -4px 0 0; }
.side-form__hint.is-error { color: #c0392b; font-weight: 600; }
.side-form input.field-invalid { border-color: #c0392b; }

.related-houses { margin-top: 72px; }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 12, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.lightbox[hidden] { display: none; }
.lightbox-image {
  max-width: min(1100px, 90vw);
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
}
.lightbox-close:hover,
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-close {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
}
.lightbox-nav[hidden] { display: none; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
}

@media (max-width: 640px) {
  .lightbox { padding: 16px; }
  .lightbox-nav { width: 42px; height: 42px; font-size: 22px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close { top: 10px; right: 10px; }
}

@media (max-width: 900px) {
  .house-detail-body { grid-template-columns: 1fr; }
  .house-detail-side { position: static; }
  .gallery-main { height: 280px; }
}

/* ---------- Admin ---------- */

.admin-body { background: var(--bg-soft); min-height: 100vh; }

.login-box {
  max-width: 380px;
  margin: 10vh auto 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  text-align: center;
}
.login-box h1 { font-size: 22px; margin: 0 0 6px; }
.login-hint { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.login-form label { font-size: 14px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
.login-form input {
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 15px;
}
.back-link { display: inline-block; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.back-link:hover { color: var(--accent); }

html:has(.admin-header[data-menu-ready]) { scroll-padding-top: calc(var(--admin-header-size) + 8px); }
.admin-header { background: #fff; border-bottom: 1px solid var(--line); }
.admin-header[data-menu-ready] { position: sticky; top: 0; z-index: 30; }
.admin-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  min-height: var(--admin-header-size);
  gap: 12px 20px;
}
.admin-header-brand { display: grid; min-width: 0; line-height: 1.25; }
.admin-header-brand .logo { font-size: 18px; }
.admin-header-current { font-size: 12px; color: var(--text-muted); }
.admin-header-navigation,
.admin-nav,
.admin-nav__links,
.admin-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.admin-header-navigation { flex: 1; justify-content: space-between; gap: 12px; }
.admin-header-actions { gap: 6px; }
.admin-header-actions .btn { padding: 8px 12px; white-space: nowrap; }
.admin-nav__label { padding-inline: 10px; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.admin-nav__link,
.admin-nav__toggle,
.admin-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}
.admin-nav__link:hover,
.admin-nav__toggle:hover,
.admin-nav__toggle[aria-expanded="true"],
.admin-menu-toggle:hover,
.admin-menu-toggle[aria-expanded="true"] { background: var(--bg-soft); }
.admin-nav__link[aria-current="page"],
.admin-nav__toggle.is-active { background: #f3e9de; color: var(--accent-dark); }
.admin-header :is(a, button):focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.admin-nav__toggle, .admin-menu-toggle { display: none; cursor: pointer; }
.admin-nav__toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  margin: -3px 2px 0 0;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.admin-nav__toggle[aria-expanded="true"]::after { transform: translateY(3px) rotate(225deg); }
.admin-menu-toggle { border-color: var(--line); min-height: 44px; }
.admin-menu-toggle::before {
  content: "";
  width: 14px;
  height: 12px;
  border-block: 2px solid;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}
.admin-badge {
  background: #c0392b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
}

@media (width > 900px) {
  .admin-header[data-menu-ready] .admin-header-inner,
  .admin-header[data-menu-ready] .admin-header-navigation { flex-wrap: nowrap; }
  .admin-header[data-menu-ready] .admin-nav { margin-inline: auto; white-space: nowrap; }
  .admin-header[data-menu-ready] .admin-nav__toggle { display: inline-flex; }
  .admin-header[data-menu-ready] .admin-nav__label,
  .admin-header[data-menu-ready] .admin-nav__toggle[aria-expanded="false"] + .admin-nav__links { display: none; }
  .admin-header[data-menu-ready] .admin-nav__group { position: relative; }
  .admin-header[data-menu-ready] .admin-nav__links {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    display: grid;
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 900px) {
  .admin-header-inner { padding-inline: 16px; }
  .admin-header[data-menu-ready] .admin-menu-toggle { display: inline-flex; }
  .admin-header[data-menu-ready] .admin-menu-toggle[aria-expanded="false"] + .admin-header-navigation { display: none; }
  .admin-header[data-menu-ready] .admin-header-navigation {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    display: block;
    max-height: calc(100vh - var(--admin-header-size));
    max-height: calc(100dvh - var(--admin-header-size));
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
  }
  .admin-header-navigation { flex-basis: 100%; }
  .admin-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); align-items: start; width: 100%; gap: 10px; }
  .admin-nav__links { display: grid; gap: 2px; }
  .admin-nav__label { display: block; padding-block: 4px; }
  .admin-nav__link { min-height: 44px; }
  .admin-header-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
}

.admin-main { padding: 32px 24px 64px; }
.admin-section-title { margin: 40px 0 20px; font-size: 22px; }
.admin-section-header { display: flex; align-items: baseline; gap: 10px; }
.admin-section-header .admin-section-title { margin-bottom: 20px; }
.admin-section-count { color: var(--text-muted); font-size: 14px; }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; }
.alert-success { background: #e6f4ea; color: #1e7d32; }
.alert-error { background: #fdecea; color: #b3261e; }

.admin-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.admin-card + .admin-card { margin-top: 0; }
.admin-card__row { display: flex; gap: 20px; flex-wrap: wrap; }
.admin-public-preview { margin-bottom: 16px; }
.admin-public-preview > summary { cursor: pointer; font-weight: 700; }
.admin-public-preview__actions { margin: 12px 0; }
.admin-public-preview__frame {
  display: block;
  width: 100%;
  height: min(70vh, 720px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.admin-preview {
  width: 220px;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.admin-preview--house { width: 160px; height: 110px; }
.admin-upload-form { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 12px; }
.admin-upload-form label { font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 5px; }
.admin-upload-form input,
.admin-upload-form select,
.admin-upload-form textarea {
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-family: inherit;
}
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-form-grid--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.admin-contacts-form { max-width: 780px; }
.admin-upload-form button { align-self: flex-start; }
.admin-form-actions { display: flex; }
.admin-upload-form label.admin-checkbox {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.admin-upload-form .admin-checkbox input[type="checkbox"] { width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--accent); flex: none; }
.admin-project-parameters { min-width: 0; margin: 4px 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.admin-project-parameters > legend { padding: 0 6px; font-size: 15px; font-weight: 600; }
.admin-project-parameters > .field-hint { margin: 0 0 14px; }
.admin-project-parameters__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.admin-project-parameters select { width: 100%; min-width: 0; background: #fff; color: var(--text); }
.admin-project-parameters__multiple { min-width: 0; margin: 16px 0 0; padding: 0; border: 0; }
.admin-project-parameters__multiple legend { margin-bottom: 10px; font-size: 13px; color: var(--text-muted); }
.admin-project-parameters__options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px 16px; }
.admin-upload-form .admin-project-parameters__options label { flex-wrap: nowrap; align-items: flex-start; font-size: 13px; }
.admin-home-mark { color: var(--accent); margin-right: 2px; }
.admin-pager__item.is-active .admin-home-mark { color: #fff; }

.admin-card--settings { max-width: 480px; }
.settings-divider { border: none; border-top: 1px solid var(--line); margin: 6px 0; }
.field-hint { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.admin-upload-form input:disabled { background: var(--bg-soft); color: var(--text-muted); }

.admin-houses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.admin-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.admin-pager__nav {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s ease, color .15s ease;
}
.admin-pager__nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.admin-pager__nav:disabled { opacity: .35; cursor: default; }
.admin-pager__list {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.admin-pager__item {
  flex: 0 0 auto;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.admin-pager__item:hover { border-color: var(--accent); color: var(--text); }
.admin-pager__item.is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.admin-pager__counter { flex: 0 0 auto; font-size: 13px; color: var(--text-muted); white-space: nowrap; }

.admin-houses-list { display: flex; flex-direction: column; gap: 24px; }
.admin-house-card { max-width: 900px; }
.admin-house-config { margin-bottom: 16px; }
.admin-house-estimate {
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.admin-house-estimate__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.admin-house-estimate h3 { margin: 0; font-size: 16px; }
.admin-house-estimate__form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; min-width: 0; }
.admin-house-estimate__form label { flex: 1 1 220px; min-width: 0; }
.admin-house-estimate__form select { width: 100%; min-width: 0; }
.admin-house-estimate__form .admin-form-actions { flex-wrap: wrap; }
.specs-textarea { font-family: ui-monospace, "Courier New", monospace; font-size: 13px; }

.admin-gallery-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.admin-gallery-section h4 { margin: 0 0 12px; font-size: 15px; }
.admin-empty--small { font-size: 13px; margin: 0 0 12px; }
.admin-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.admin-gallery-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-gallery-item img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.admin-home-collection { margin-top: 16px; }
.admin-home-collection + .admin-home-collection { padding-top: 16px; border-top: 1px solid var(--line); }
.admin-home-collection__header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.admin-gallery-grid.admin-home-collection__cards { margin: 0; padding: 0; list-style: none; }
.admin-gallery-upload { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.admin-gallery-upload label { font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 5px; }
.admin-gallery-upload input { font-size: 13px; }

.btn-danger { background: transparent; color: #b3261e; border: 1px solid #f2c6c2; }
.btn-danger:hover { background: #fdecea; }
.btn-success { background: transparent; color: #1e7d32; border: 1px solid #bfe3c7; }
.btn-success:hover { background: #e6f4ea; }
.admin-delete-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

.admin-card--new {
  border-style: dashed;
  border-color: #c9c2b6;
  background: var(--bg-soft);
}
.admin-new-title { margin: 0 0 14px; font-size: 17px; color: var(--text-muted); }

/* ---------- Leads / requests ---------- */

.admin-empty { color: var(--text-muted); }

.admin-section-header--wide { justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.admin-requests-toolbar { display: flex; align-items: center; gap: 14px; }
.auto-refresh-indicator {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.auto-refresh-indicator::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2e7d32;
  display: inline-block;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.leads-contacts-cell { display: flex; flex-direction: column; gap: 2px; }
.leads-contacts-cell a:hover { color: var(--accent); }

.leads-comment-cell { white-space: normal; min-width: 220px; }
.comment-form { display: flex; flex-direction: column; gap: 6px; }
.comment-form textarea {
  width: 100%;
  min-width: 200px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
.comment-form button { align-self: flex-start; }

.leads-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.leads-table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
.leads-table th, .leads-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.leads-table th { color: var(--text-muted); font-weight: 600; font-size: 13px; }
.leads-table tbody tr:last-child td { border-bottom: none; }
.leads-table tbody tr:hover { background: var(--bg-soft); }

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.status-badge--new { background: #fff4e0; color: #a3670f; }
.status-badge--completed { background: #e6f4ea; color: #1e7d32; }
.status-badge--rejected { background: #fdecea; color: #b3261e; }

.leads-actions { display: flex; gap: 8px; }
.leads-actions form { display: inline; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .main-nav { display: none; }
  .mobile-nav { display: block; margin-left: auto; }
  .mobile-nav summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
  }
  .mobile-nav summary::-webkit-details-marker { display: none; }
  .mobile-nav summary::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
  }
  .mobile-nav[open] summary::after { transform: translateY(1px) rotate(225deg); }
  .mobile-nav__links {
    position: absolute;
    inset: 100% 0 auto;
    display: grid;
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
    padding: 8px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    box-shadow: var(--shadow);
  }
  .mobile-nav__links a { padding: 9px 0; }
  .mobile-nav__links a + a { border-top: 1px solid var(--line); }
  .mobile-nav__links a.is-active { color: var(--accent-dark); font-weight: 600; }
}
@media (max-width: 780px) {
  .footer-inner { grid-template-columns: 1fr; }
  .cta-inner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .header-inner { gap: 12px; }
  .site-header .phone { display: none; }
}

/* ---------- Project selection (public) ---------- */

.calc-form { display: grid; gap: 24px; }
.calc-block--choices { margin: 0; padding: 0; border: 0; min-width: 0; }
.calc-block__description { margin: -4px 0 16px; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.calc-block__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 20px;
}

.calc-area-fields { display: flex; align-items: center; gap: 16px; }
.calc-area-fields__dash { color: var(--text-muted); }
.calc-area__value {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 600;
  min-width: 0;
}
.calc-area__value input { width: 70px; border: none; font: inherit; font-size: 20px; text-align: right; background: transparent; color: var(--text); }
.calc-area__value input:focus { outline: none; }
.calc-area__value:focus-within { border-color: var(--accent); }
.calc-area__scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.calc-range { position: relative; height: 32px; margin-top: 20px; }
.calc-range__track { position: absolute; inset: 13px 0 auto; height: 5px; border-radius: 4px; background: var(--line); }
.calc-range__track span { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: var(--accent); }
.calc-range input { position: absolute; inset: 0; width: 100%; height: 32px; margin: 0; appearance: none; background: transparent; pointer-events: none; }
.calc-range input::-webkit-slider-runnable-track { height: 5px; background: transparent; }
.calc-range input::-moz-range-track { height: 5px; background: transparent; }
.calc-range input::-webkit-slider-thumb { appearance: none; width: 22px; height: 22px; margin-top: -8px; border: 2px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); cursor: grab; pointer-events: auto; }
.calc-range input::-moz-range-thumb { width: 18px; height: 18px; border: 2px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); cursor: grab; pointer-events: auto; }
.calc-range input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; z-index: 4; }

.calc-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.calc-option { position: relative; cursor: pointer; }
.calc-option__input { position: absolute; opacity: 0; pointer-events: none; }
.calc-option__card {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 18px 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text-muted);
  transition: border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .15s ease;
}
.calc-option:hover .calc-option__card { border-color: var(--accent); transform: translateY(-1px); }
.calc-option__input:focus-visible + .calc-option__card { outline: 2px solid var(--accent); outline-offset: 2px; }
.calc-option__input:checked + .calc-option__card {
  border-color: var(--accent);
  background: #fbf6f0;
  color: var(--accent-dark);
  box-shadow: 0 6px 18px rgba(163, 112, 63, 0.15);
}
.calc-option__input:checked + .calc-option__card::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calc-icon { width: 48px; height: 48px; flex: none; }
.calc-icon--image { object-fit: contain; }
.calc-option__title { font-weight: 600; color: var(--text); font-size: 15px; line-height: 1.3; }
.calc-option__hint { font-size: 12px; line-height: 1.35; }
.calc-option__any { display: flex; align-items: center; height: 48px; font-weight: 600; font-size: 17px; color: var(--accent-dark); }
.calc-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.calc-reset { color: var(--accent-dark); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

.calc-matches { scroll-margin-top: 90px; min-width: 0; }
.calc-matches__results[aria-busy="true"] { opacity: .6; }
.calc-matches__count { margin: 12px 0; font-size: 14px; }
.calc-matches__note { margin: 14px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.calc-request-status { margin: 10px 0; font-size: 12px; color: var(--text-muted); }
.calc-request-status:empty { display: none; }
.calc-projects-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.calc-project { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.calc-project__image { display: block; }
.calc-project__image img { display: block; width: 100%; height: 132px; object-fit: cover; }
.calc-project__body { padding: 14px; }
.calc-project__body h3 { margin: 0 0 4px; font-size: 17px; overflow-wrap: anywhere; }
.calc-project__area { display: block; margin: 0 0 12px; color: var(--text-muted); font-size: 14px; }
.calc-empty { padding: 12px 0; }
.calc-empty h3 { margin: 0 0 8px; font-size: 17px; }
.calc-empty p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.calc-empty .btn { display: block; margin-top: 16px; text-align: center; }

/* ---------- Calculator (admin) ---------- */

.calc-admin-help { font-size: 14px; color: var(--text-muted); }
.calc-admin-help ul { margin: 8px 0 0; padding-left: 20px; }
.calc-admin-help b { color: var(--text); }
.calc-admin-subtitle { margin: 32px 0 14px; font-size: 18px; }
.calc-admin-area { grid-template-columns: repeat(2, 1fr); }
.calc-admin-block { scroll-margin-top: 16px; }
.calc-admin-block__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.calc-admin-block__head h4 { margin: 0; font-size: 17px; flex: 1; }
.calc-admin-block__head .admin-stage__toolbar { margin: 0; }
.calc-admin-block__meta { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.calc-admin-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-muted); flex: 1; min-width: 220px; }
.calc-admin-form input[type="text"],
.calc-admin-form select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  min-width: 0;
  width: 100%;
}
.calc-admin-check { font-size: 14px; display: flex; align-items: center; gap: 8px; padding-bottom: 8px; cursor: pointer; }
.calc-admin-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.calc-admin-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.calc-admin-row {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 80px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.calc-admin-row--head { border: none; background: none; padding: 0 10px; font-size: 12px; color: var(--text-muted); }
.calc-admin-row--new { border-style: dashed; background: var(--bg-soft); }
.calc-admin-icon { display: flex; gap: 10px; align-items: center; min-width: 0; }
.calc-admin-icon__preview {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbf6f0;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.calc-admin-icon__preview svg,
.calc-admin-icon__preview img { width: 36px; height: 36px; object-fit: contain; }
.calc-admin-icon__controls { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.calc-admin-upload { font-size: 11px; color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; }
.calc-admin-upload input { font-size: 11px; max-width: 100%; }
.calc-admin-texts { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.calc-admin-remove { font-size: 12px; color: #b3261e; display: flex; align-items: center; gap: 4px; cursor: pointer; }

@media (max-width: 1000px) {
  .calc-admin-row { grid-template-columns: 1fr 1fr; }
  .calc-admin-row--head { display: none; }
  .calc-admin-icon, .calc-admin-texts { grid-column: 1 / -1; }
  .calc-admin-area { grid-template-columns: 1fr 1fr; }
}

/* Заявки: конфигурация из калькулятора под именем */
.lead-details { margin-top: 6px; font-size: 12px; line-height: 1.45; color: var(--text-muted); max-width: 340px; }

.estimate-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.estimate-template-copy { max-width: 100%; }
.estimate-template-copy[open] { width: min(100%, 320px); }
.estimate-template-copy > summary::-webkit-details-marker { display: none; }
.estimate-template-copy .admin-upload-form { min-width: 0; margin-top: 12px; }
.estimate-template-copy .alert { margin-bottom: 0; }

.estimate-editor { min-width: 0; }
.estimate-editor-links { display: flex; flex-wrap: wrap; gap: 8px; }
.estimate-unit-list {
  max-height: min(22rem, 50vh);
  overflow-y: auto;
  padding-inline: 4px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.estimate-unit-form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  align-items: end;
  min-width: 0;
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
}
.estimate-unit-form input { min-width: 0; }
.estimate-unit-form button { align-self: end; }
.estimate-unit-form:last-child { border-bottom: 0; }
@media (max-width: 560px) {
  .estimate-unit-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.estimate-editor-main { max-width: 1400px; }
.estimate-sheet {
  --sheet-grid: #d5ddea;
  --sheet-axis: #edf1f7;
  --sheet-focus: #345dba;
  color: #1d304b;
  background: #fff;
  border: 1px solid #aab9cf;
}
.estimate-editor .estimate-sheet-title {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--sheet-grid);
  background: #f5f7fb;
  color: inherit;
  font-weight: 600;
}
.estimate-sheet-title input {
  width: min(100%, 420px);
  padding: 5px 8px;
  border: 1px solid #bdcada;
  border-radius: 2px;
  background: #fff;
  color: inherit;
}
.estimate-table-scroll {
  max-height: min(65vh, 44rem);
  overflow: auto;
  scroll-padding: 52px 8px 10px 42px;
}
.estimate-table {
  width: 100%;
  min-width: 875px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.35;
}
.estimate-col-index { width: 42px; }
.estimate-col-position { width: 44px; }
.estimate-col-unit { width: 12%; }
.estimate-col-number { width: 13%; }
.estimate-col-actions { width: 145px; }
.estimate-table th, .estimate-table td {
  padding: 5px 8px;
  border-right: 1px solid var(--sheet-grid);
  border-bottom: 1px solid var(--sheet-grid);
  text-align: left;
  vertical-align: middle;
}
.estimate-table tr > :last-child { border-right: 0; }
.estimate-table thead { position: sticky; top: 0; z-index: 2; }
.estimate-table .estimate-column-letters td,
.estimate-table .estimate-row-index {
  background: var(--sheet-axis);
  color: #455a79;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.estimate-table .estimate-column-letters td { padding-block: 3px; }
.estimate-table .estimate-row-index { position: sticky; left: 0; z-index: 1; padding-inline: 4px; }
.estimate-table tr:focus-within > .estimate-row-index { background: #dbe6fb; color: #294995; }
.estimate-table .estimate-position-index { text-align: center; font-variant-numeric: tabular-nums; }
.estimate-column-headings { background: #e3eaf5; }
.estimate-stage-heading, .estimate-stage-total { background: #e0e9f7; }
.estimate-group-heading, .estimate-group-total { background: #f0f4fa; }
.estimate-grand-total { background: #d7e3f7; }
.estimate-table .estimate-group-heading [data-group-title] { padding-left: 16px; }
.estimate-stage-total th, .estimate-group-total th, .estimate-grand-total th { text-align: right; }
.estimate-item .estimate-item-total, .estimate-table [data-group-total],
.estimate-table [data-stage-total], .estimate-table [data-estimate-total] {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.estimate-table button {
  padding: 3px 7px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}
.estimate-table button:hover { transform: none; }
.estimate-table .btn-outline { border-color: #b4c2d8; background: #fff; color: #254879; }
.estimate-table .btn-outline:hover:not(:disabled) { background: #edf3ff; border-color: var(--sheet-focus); }
.estimate-table .btn-ghost:hover { background: #e6edf8; color: #1d304b; }
.estimate-table [data-add-group]:disabled { opacity: .45; cursor: default; transform: none; }
.estimate-editor .estimate-stage-name { display: flex; flex-direction: row; align-items: center; gap: 10px; color: inherit; }
.estimate-stage-name select {
  width: 100%;
  min-width: 0;
  padding: 4px 7px;
  border-color: #b4c2d8;
  border-radius: 2px;
  background: #fff;
  font-weight: 600;
}
.estimate-table .estimate-cell-input { padding: 0; }
.estimate-cell-input input, .estimate-cell-input select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 29px;
  padding: 4px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}
.estimate-sheet :is(input, select):focus, .estimate-sheet button:focus-visible {
  outline: 2px solid var(--sheet-focus);
  outline-offset: -2px;
}
.estimate-item input[inputmode="decimal"] { text-align: right; }
