:root {
  --ink: #102019;
  --muted: #66756c;
  --paper: #ffffff;
  --soft: #f3f8f4;
  --line: #d9e7de;
  --green: #1f8a4c;
  --green-dark: #0c5f33;
  --lime: #b9df6b;
  --blue: #276b9f;
  --graphite: #17211c;
  --danger: #b54747;
  --shadow: 0 20px 60px rgba(16, 32, 25, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: clamp(28px, 6vw, 76px);
  align-items: center;
  padding: clamp(24px, 6vw, 80px);
  color: #fff;
  background:
    linear-gradient(110deg, rgba(9, 28, 18, 0.95), rgba(15, 75, 43, 0.83) 52%, rgba(18, 86, 58, 0.5)),
    url("assets/category-building.jpg") center / cover;
}

.login-art h1,
.showcase h1 {
  margin: 0 0 18px;
  font-size: clamp(76px, 13vw, 164px);
  line-height: 0.86;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 680px;
  color: #e7f2ea;
  font-size: 21px;
  line-height: 1.5;
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 2px -26px 8px;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  min-height: 52px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  border-bottom: 3px solid transparent;
}

.auth-tab.active {
  color: var(--green);
  border-color: var(--green);
}

.auth-pane {
  display: none;
  gap: 14px;
}

.auth-pane.active {
  display: grid;
}

.forgot-link {
  justify-self: center;
  color: var(--muted);
  font-weight: 850;
}

.check-row {
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 10px;
  color: var(--muted);
}

.check-row input {
  min-height: 20px;
  margin-top: 1px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 36px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 950;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  min-height: 72px;
  padding: 0 clamp(18px, 5vw, 72px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

nav, .user-tools, .hero-actions, .contact-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

nav {
  justify-content: center;
  color: #34463b;
  font-weight: 850;
}

.user-tools { justify-content: end; }

.primary, .secondary, .ghost-button, .profile-button, button, .contact-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

button, .primary, .profile-button {
  background: var(--green);
  color: #fff;
}

.secondary, .ghost-button {
  background: #ecf4ef;
  color: var(--green-dark);
}

.icon-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: #eef4f0;
  color: var(--green-dark);
  font-size: 22px;
}

.showcase {
  min-height: 460px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: 22px;
  padding: clamp(56px, 8vw, 96px) clamp(18px, 5vw, 72px);
  color: #fff;
  background:
    linear-gradient(110deg, rgba(9, 28, 18, 0.94), rgba(15, 75, 43, 0.78) 56%, rgba(18, 86, 58, 0.3)),
    url("assets/category-building.jpg") center / cover;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(40px, 7vw, 72px); line-height: 0.96; }
h2 { margin-bottom: 14px; font-size: clamp(30px, 4vw, 52px); line-height: 1.04; }
h3 { margin-bottom: 8px; font-size: 20px; }

.lot-card, .cabinet-panel, .cabinet-nav, .admin-drawer, .search-panel, .map-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 32, 25, 0.06);
}

.lot-cover { min-height: 180px; background: var(--soft) center / cover; }
.lot-body { padding: 18px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #e8f6ec;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

section:not(.showcase) { padding: 76px clamp(18px, 5vw, 72px); }
.page-section { min-height: calc(100vh - 72px); }
.catalog-section, .cabinet { background: #f7faf8; }

.catalog-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 28px;
  align-items: end;
  margin-bottom: 24px;
}

.catalog-heading p, .lot-card p, .cabinet-panel p, .form-note, .map-panel p, .contact p { color: var(--muted); line-height: 1.55; }

.search-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(160px, 1fr)) 46px;
  gap: 10px;
  align-items: end;
  padding: 14px;
}

label { display: grid; gap: 7px; color: #3c4d43; font-weight: 850; }
label span { font-size: 12px; text-transform: uppercase; color: var(--muted); }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 112px; padding-top: 12px; resize: vertical; }

.catalog-summary {
  display: grid;
  grid-template-columns: repeat(3, auto) 1fr;
  gap: 14px;
  align-items: center;
  margin: 16px 0 18px;
}
.catalog-summary div, .catalog-summary button { min-height: 52px; padding: 10px 14px; border-radius: 8px; }
.catalog-summary div { border: 1px solid var(--line); background: #fff; }
.catalog-summary strong { margin-right: 8px; color: var(--green-dark); font-size: 22px; }
.catalog-summary span { color: var(--muted); font-weight: 750; }

.map-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 420px); gap: 18px; padding: 18px; margin-bottom: 18px; }
.map-regions { display: grid; gap: 8px; }
.map-region { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--soft); font-weight: 850; }

.lot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lot-card { overflow: hidden; }
.lot-topline { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 850; }
.lot-card h3 { margin-top: 10px; font-size: 24px; }
.lot-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.lot-meta div { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.lot-meta span { display: block; color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.lot-meta strong { display: block; margin-top: 4px; }
.lot-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; }
.favorite { background: #eef5f9; color: var(--blue); }
.track-button { min-width: 132px; padding: 0 12px; }
.track-button.active { background: #e5f4dc; color: var(--green-dark); }

.cabinet-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; }
.cabinet-nav { display: grid; align-content: start; gap: 8px; padding: 12px; }
.tab-button { justify-content: flex-start; background: transparent; color: var(--ink); }
.tab-button.active { background: var(--green); color: #fff; }
.cabinet-panel { min-height: 320px; padding: 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.stat-card strong { display: block; margin-top: 8px; font-size: 28px; color: var(--green-dark); }
.list-stack { display: grid; gap: 10px; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.document-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.document-upload-grid label {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.document-upload-grid input { padding: 10px; background: #fff; }
.document-upload-grid small {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}
.document-fields textarea { min-height: 92px; }
.questionnaire-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.questionnaire-grid .wide { grid-column: 1 / -1; }
.questionnaire-grid textarea { min-height: 96px; }
.questionnaire-consent {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.questionnaire-consent input { min-height: 22px; margin: 0; }
.questionnaire-consent span {
  color: #3c4d43;
  font-size: 14px;
  line-height: 1.45;
  text-transform: none;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.form-actions .form-note { margin: 0; }
.password-form { max-width: 520px; }

.contact { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; background: var(--green-dark); color: #fff; }
.contact h2 { margin-bottom: 8px; font-size: clamp(46px, 8vw, 96px); }
.contact p { margin-bottom: 0; color: #e4f1e8; }
.contact-actions a { border: 1px solid rgba(255, 255, 255, 0.24); color: #fff; }

.contact-page {
  display: grid;
  gap: 28px;
  background: #f7faf8;
}
.contact-page p {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.contact-grid a {
  display: grid;
  gap: 6px;
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 32, 25, 0.06);
}
.contact-grid strong { color: var(--green-dark); font-size: 18px; }
.contact-grid span { color: var(--muted); }

.document-shell { min-height: 100vh; background: #f7faf8; }
.doc-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 0 clamp(18px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}
.doc-top nav {
  justify-content: end;
  overflow-x: auto;
  white-space: nowrap;
}
.document-page {
  padding: 44px clamp(18px, 5vw, 72px) 80px;
}
.document-card {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 52px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 32, 25, 0.06);
}
.document-card h1 {
  margin-bottom: 28px;
  font-size: clamp(34px, 5vw, 58px);
}
.document-card h2 {
  margin: 30px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 24px;
  line-height: 1.2;
}
.document-card h3 {
  margin: 20px 0 8px;
  color: var(--green-dark);
}
.document-card p {
  margin-bottom: 11px;
  color: #26382d;
  line-height: 1.65;
}

.admin-drawer {
  position: fixed;
  top: 88px;
  right: clamp(12px, 4vw, 40px);
  z-index: 40;
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 22px;
}
.drawer-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.admin-list { display: grid; gap: 18px; margin-top: 18px; }
section.admin-section { display: grid; gap: 10px; padding: 18px 0 0; border-top: 1px solid var(--line); }
section.admin-section:first-child { padding: 0; border-top: 0; }
.admin-section h3 { margin: 0; font-size: 18px; }
.drawer-section-head,
.admin-user-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.admin-lot-table-wrap {
  max-height: 540px;
  overflow: auto;
}
.admin-lot-table,
.admin-user-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #fff;
}
.admin-lot-table { min-width: 1260px; }
.admin-user-table { min-width: 1320px; }
.admin-filter-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(180px, 1fr) minmax(180px, 1fr) minmax(150px, 0.8fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}
.admin-user-filter { grid-template-columns: minmax(280px, 1fr) auto auto; }
.filter-count {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}
.admin-lot-table th,
.admin-lot-table td,
.admin-user-table th,
.admin-user-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.admin-lot-table th,
.admin-user-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.admin-lot-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}
.admin-lot-table td small,
.admin-user-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.admin-lot-table tr:last-child td,
.admin-user-table tr:last-child td { border-bottom: 0; }
.lot-code-cell { width: 150px; }
.lot-title-cell { width: 285px; }
.lot-title-cell strong {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.lot-price-cell { width: 150px; white-space: nowrap; font-weight: 900; color: var(--green-dark); }
.lot-cadaster-cell { width: 190px; overflow-wrap: anywhere; }
.lot-address-cell { min-width: 290px; line-height: 1.45; }
.admin-lot-action {
  position: sticky;
  right: 0;
  width: 150px;
  background: #fff;
  box-shadow: -8px 0 18px rgba(16, 32, 25, 0.04);
}
.admin-lot-action button { width: 126px; padding: 0 10px; }
.admin-actions {
  display: flex;
  gap: 8px;
  min-width: 220px;
}
.admin-actions a { min-height: 38px; }
.admin-user-activity {
  display: grid;
  gap: 3px;
  min-width: 240px;
}
.admin-user-activity strong {
  color: var(--green-dark);
  font-size: 13px;
}
.admin-user-activity span {
  color: #415449;
  font-size: 12px;
  line-height: 1.35;
}
.admin-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.admin-row small { display: block; color: var(--muted); margin-top: 4px; }
.user-row { grid-template-columns: 1fr; background: #fbfdfb; }
.activity-list, .mini-activity { display: grid; gap: 8px; }
.mini-activity { margin-top: 10px; }
.activity-item { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f7faf8; }
.activity-item strong { color: var(--green-dark); }
.activity-item small { margin-top: 0; color: var(--muted); }
.activity-item span { color: #415449; font-size: 13px; font-weight: 750; }
.danger { background: var(--danger); color: #fff; }
.empty-state { grid-column: 1 / -1; padding: 28px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; color: var(--muted); }

.admin-user-page { background: #f7faf8; }
.admin-user-panel { display: grid; gap: 14px; }
.admin-detail-section {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 32, 25, 0.06);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.detail-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.detail-row.wide { grid-column: 1 / -1; }
.detail-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.detail-row strong {
  color: #24382c;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.document-list { display: grid; gap: 10px; }
.document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.document-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

@media (max-width: 1040px) {
  .login-screen, .showcase, .catalog-heading, .map-panel, .contact { grid-template-columns: 1fr; }
  .search-panel, .lot-grid, .stat-grid, .admin-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cabinet-layout { grid-template-columns: 1fr; }
  .document-upload-grid, .questionnaire-grid, .detail-grid { grid-template-columns: 1fr; }
  .questionnaire-grid .wide, .detail-row.wide { grid-column: auto; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .login-screen {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 22px;
    padding: 28px 16px;
  }
  .login-art h1 {
    margin-bottom: 0;
    font-size: clamp(68px, 26vw, 112px);
  }
  .login-card {
    width: 100%;
    padding: 20px;
  }
  .auth-tabs {
    margin-inline: -20px;
  }
  .topbar {
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 10px 14px;
  }
  nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    white-space: nowrap;
  }
  nav a { padding: 6px 2px; }
  .brand-note { display: none; }
  .user-tools {
    justify-content: end;
    gap: 8px;
  }
  .profile-button, .ghost-button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 14px;
  }
  .icon-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }
  .showcase {
    min-height: 340px;
    padding: 48px 16px;
  }
  .showcase h1 { font-size: clamp(72px, 28vw, 118px); }
  .hero-copy p { font-size: 18px; }
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  section:not(.showcase) { padding: 44px 16px; }
  h1 { font-size: clamp(36px, 13vw, 56px); }
  .catalog-heading { gap: 8px; margin-bottom: 16px; }
  .search-panel, .lot-grid, .stat-grid, .catalog-summary, .lot-meta, .lot-actions, .admin-filter-panel { grid-template-columns: 1fr; }
  .catalog-summary { gap: 8px; }
  .lot-cover { min-height: 150px; }
  .lot-topline { display: grid; }
  .cabinet-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tab-button {
    min-height: 40px;
    justify-content: center;
    padding: 0 10px;
    font-size: 14px;
  }
  .cabinet-panel { padding: 16px; }
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .list-row, .admin-row, .document-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .admin-actions, .admin-user-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .contact {
    gap: 16px;
  }
  .contact h2 { font-size: 56px; }
  .contact-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .admin-drawer {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 20px);
    padding: 16px;
  }
  .doc-top {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
    padding: 12px 16px;
  }
  .doc-top nav {
    justify-content: start;
    gap: 12px;
    width: 100%;
  }
  .document-page { padding: 24px 16px 48px; }
  .document-card { padding: 18px; }
  .document-card h2 { font-size: 21px; }
}
