:root {
  --bg: #f2f5ef;
  --bg-2: #dde8d8;
  --panel: #ffffff;
  --line: #d6decf;
  --text: #1f2b22;
  --muted: #59675c;
  --brand: #1c7a4b;
  --brand-strong: #10673c;
  --accent: #f5a524;
  --chat-left: #f0f4ef;
  --chat-right: #d6f0df;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, #f8f0d9 0%, transparent 38%),
    radial-gradient(circle at 100% 100%, #d8ebff 0%, transparent 30%),
    linear-gradient(165deg, var(--bg), var(--bg-2));
  min-height: 100vh;
}

.app-root {
  max-width: 1250px;
  margin: 0 auto;
  padding: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: var(--brand);
  font-weight: 700;
}

.auth-view {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  align-items: start;
  gap: 1rem;
}

.auth-page {
  display: grid;
  gap: 1rem;
}

.welcome-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 14px 26px rgba(26, 40, 28, 0.08);
}

.welcome-panel {
  padding: 1.6rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(28, 122, 75, 0.09) 0%, transparent 42%),
    linear-gradient(180deg, #ffffff, #fbfdf9);
}

.welcome-panel h1 {
  margin: 0.2rem 0 0.6rem;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.15;
}

.auth-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.welcome-lead {
  margin: 0 0 0.75rem;
  font-size: 1.02rem;
  color: #233429;
}

.welcome-story {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.welcome-story p {
  margin: 0;
  color: #33463a;
  line-height: 1.5;
}

.auth-info-section {
  margin-top: 0.95rem;
  padding-top: 0.95rem;
  border-top: 1px dashed #d4dfcc;
}

.auth-info-section h3 {
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  color: #2d6b4c;
}

.auth-section-subtitle {
  margin: 0.35rem 0 0.65rem;
}

.auth-info-list {
  display: grid;
  gap: 0.6rem;
}

.auth-info-item {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.55rem 0.6rem;
  border-radius: 12px;
  background: #f3f8f2;
  border: 1px solid #d7e5d3;
}

.auth-info-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #d9efe2;
  color: #165736;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.auth-info-item p {
  margin: 0;
}

.auth-info-item p:first-child {
  font-weight: 700;
  color: #22382d;
}

.auth-info-item p + p {
  margin-top: 0.2rem;
  color: #3e5548;
  line-height: 1.45;
  font-size: 0.94rem;
}

.auth-entry-panel {
  position: sticky;
  top: 1rem;
  padding: 1.15rem;
}

.auth-entry-panel h2 {
  margin-bottom: 0.45rem;
}

#auth-submit-btn {
  background: linear-gradient(180deg, #1f8a54, #146f43);
}

#auth-submit-btn:hover {
  background: linear-gradient(180deg, #187544, #115d38);
}

#auth-recovery-page .panel {
  max-width: 560px;
}

.text-link-btn {
  width: auto;
  margin-top: 0.7rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
}

.text-link-btn:hover {
  background: transparent;
  color: var(--brand-strong);
  transform: none;
}

.panel {
  padding: 1rem;
}

.subtle {
  margin-top: 0.75rem;
}

.muted-panel {
  background: #f4f8f2;
}

h2,
h3 {
  margin: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.8rem 0;
}

.stack-form {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.form-label span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
}

input,
textarea,
select,
button {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #c6d2c4;
  background: #fff;
}

textarea {
  min-height: 105px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #7ec49f;
  box-shadow: 0 0 0 4px rgba(40, 140, 88, 0.15);
}

button {
  cursor: pointer;
  border: none;
  background: var(--brand);
  color: #fff;
  font-weight: 650;
  transition: transform 0.15s ease, background 0.15s ease;
}

button:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

.app-view {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 1rem;
  min-height: 72vh;
}

.sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
  background: #132a1d;
  color: #e8f2e5;
  border-radius: 18px;
  border: 1px solid #2f513b;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar .eyebrow {
  color: #9dd9b8;
}

.sidebar-nav {
  display: grid;
  gap: 0.45rem;
}

.nav-link {
  text-align: left;
  background: #224130;
  border: 1px solid #325741;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.nav-link.active {
  background: var(--accent);
  color: #18271f;
}

.logout-btn {
  margin-top: auto;
  background: #8f2f2f;
}

.unread-badge {
  min-width: 1.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: #d94f2b;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: center;
  font-weight: 700;
}

.main-content {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid #d3ddcc;
  border-radius: 20px;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

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

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.address-input-wrap {
  position: relative;
}

.address-input-wrap input {
  padding-right: 2.9rem;
}

.locate-inside-btn {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #b8dec5;
  background: #e8f6ee;
  color: #1f7447;
  font-size: 1.05rem;
  line-height: 1;
}

.locate-inside-btn:hover {
  background: #d6efdf;
  transform: translateY(-50%);
}

.inline-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.inline-buttons button {
  flex: 1 1 150px;
}

.offer-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 0.7rem;
}

.offer-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  min-height: 240px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.offer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 33, 24, 0.13);
}

.offer-image,
.detail-offer-image {
  width: 100%;
  object-fit: cover;
  border-bottom: 1px solid #e6ece2;
  background: #f2f5ef;
}

.offer-image {
  height: 132px;
}

.offer-meta {
  padding: 0.65rem;
  display: grid;
  gap: 0.3rem;
}

.offer-item {
  font-size: 0.98rem;
  font-weight: 700;
}

.offer-distance {
  color: #3f614c;
  font-size: 0.9rem;
}

.offer-detail {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
}

.offer-detail-media {
  display: grid;
  gap: 0.5rem;
}

.detail-offer-image {
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: zoom-in;
}

.offer-detail-meta {
  display: grid;
  gap: 0.45rem;
}

.location-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid #d4decf;
  background: #f2f6f0;
  color: #2d4636;
}

.location-badge.private {
  background: #fdf5e6;
  border-color: #edd39a;
  color: #7a5a17;
}

.location-badge.owner {
  background: #e7f6ed;
  border-color: #b9dfc6;
  color: #1e6a3f;
}

.detail-offer-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.35rem;
}

.detail-offer-thumb {
  width: 100%;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #c9d6c4;
  cursor: pointer;
}

.detail-offer-thumb.active {
  border-color: #2d8b58;
}

.offer-photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}

.offer-photo-preview img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef3ea;
}

.model-thumb {
  width: 110px;
  height: 110px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.model-match-value {
  margin-top: 0.4rem;
  font-weight: 650;
}

.model-suggestion-list {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.35rem;
}

.model-suggestion-btn {
  text-align: left;
  background: #f2f7ef;
  color: #244231;
  border: 1px solid #c6d8c6;
}

.model-suggestion-btn:hover {
  background: #e5f0e1;
  transform: none;
}

pre {
  margin: 0;
  background: #122018;
  color: #cde5d1;
  border-radius: 10px;
  padding: 0.75rem;
  overflow: auto;
}

.messages-layout {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0.8rem;
}

.thread-list-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  max-height: 540px;
  overflow: auto;
}

.thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.thread-list button {
  border-radius: 0;
  border-bottom: 1px solid #e7ece5;
  background: #fff;
  color: var(--text);
  text-align: left;
  padding: 0.7rem;
}

.thread-list button:hover {
  background: #f4f8f2;
  transform: none;
}

.thread-list button.active {
  background: #d7efdf;
}

.thread-list button.unread {
  background: #fff6e5;
  border-left: 4px solid #f0aa2b;
  padding-left: 0.5rem;
}

.thread-list button.unread .thread-title {
  color: #7a4e00;
}

.thread-list button.unread .thread-sub {
  color: #704b14;
  font-weight: 600;
}

.thread-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.thread-sub {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 0.2rem;
}

.thread-panel {
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) auto;
  min-height: 540px;
}

.thread-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.thread-header {
  font-weight: 700;
}

.chat-thread {
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafcf9;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  padding: 0.65rem;
  display: grid;
  gap: 0.5rem;
}

.chat-message {
  max-width: 70%;
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
  font-size: 0.94rem;
  line-height: 1.32;
}

.chat-message.sent {
  justify-self: end;
  background: var(--chat-right);
  border: 1px solid #b8dfc6;
}

.chat-message.received {
  justify-self: start;
  background: var(--chat-left);
  border: 1px solid #d8e2d4;
}

.chat-meta {
  margin-top: 0.28rem;
  color: #5f6e64;
  font-size: 0.75rem;
}

.thread-reply-form {
  margin-top: 0.75rem;
}

.success-note {
  color: #0f7c3a;
  font-weight: 700;
}

.my-offers-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.65rem;
}

.my-offer-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
  padding: 0.7rem;
  display: grid;
  gap: 0.5rem;
}

.my-offer-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}

.my-offer-title {
  font-weight: 700;
}

.my-offer-actions {
  display: flex;
  gap: 0.45rem;
}

.danger-btn {
  background: #a23535;
}

.edit-offer-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.my-offer-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 0.45rem;
}

.my-offer-photo-tile {
  display: grid;
  gap: 0.25rem;
}

.my-offer-photo-tile img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.small-btn {
  padding: 0.35rem 0.45rem;
  font-size: 0.8rem;
}

.log {
  margin-top: 0.9rem;
  min-height: 56px;
  white-space: pre-wrap;
}

.app-footer {
  margin-top: 1rem;
  padding: 0.85rem 0.4rem 0.2rem;
  border-top: 1px solid #d7e0d1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: #405248;
}

.app-footer a {
  color: #2b6949;
  text-decoration: none;
  font-weight: 600;
}

.app-footer a:hover {
  text-decoration: underline;
}

.footer-sep {
  color: #7a8c7f;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(12, 20, 15, 0.82);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.image-lightbox-img {
  max-width: min(1200px, 95vw);
  max-height: 86vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

.image-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: auto;
  padding: 0.45rem 0.7rem;
  background: #1d2d23;
}

.image-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  padding: 0;
  font-size: 1.7rem;
  line-height: 1;
  background: rgba(21, 33, 25, 0.85);
}

.image-lightbox-prev {
  left: 1rem;
}

.image-lightbox-next {
  right: 1rem;
}

@media (max-width: 960px) {
  .auth-cards {
    grid-template-columns: 1fr;
  }

  .auth-view {
    grid-template-columns: 1fr;
  }

  .auth-entry-panel {
    position: static;
  }

  .app-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .messages-layout {
    grid-template-columns: 1fr;
  }

  .offer-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .split-grid {
    grid-template-columns: 1fr;
  }

  .chat-message {
    max-width: 88%;
  }
}
