:root {
  --ink: #17202a;
  --muted: #637083;
  --line: rgba(23, 32, 42, 0.12);
  --paper: #fffdf8;
  --good: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: #f6f8fb;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.app-install-button {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 10050;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--good);
  box-shadow: 0 16px 36px rgba(15, 118, 110, 0.32);
  font-weight: 950;
  cursor: pointer;
}

.is-installed-app .app-install-button {
  display: none;
}

button,
textarea {
  font: inherit;
}

.inbox-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0 46px;
}

.inbox-hero {
  position: relative;
  margin-bottom: 18px;
  padding-right: 58px;
}

.inbox-hero a {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--good);
  font-weight: 950;
  text-decoration: none;
}

.inbox-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2.4rem, 8vw, 4.8rem);
  line-height: 0.92;
}

.inbox-hero p {
  margin: 0;
  color: var(--muted);
}

.inbox-cart-link {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--good);
  box-shadow: 0 14px 30px rgba(15, 118, 110, 0.28);
}

.inbox-cart-link svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

.inbox-panel {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 22px 70px rgba(17, 24, 39, 0.12);
}

.thread-list {
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.thread-button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.thread-button:hover,
.thread-button.is-active {
  background: #ecfdf5;
}

.thread-button strong,
.thread-button span {
  display: block;
}

.thread-button strong {
  margin-bottom: 4px;
}

.thread-button span {
  color: var(--muted);
  font-size: 0.86rem;
}

.thread-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.thread-head {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.thread-head span {
  color: var(--muted);
  font-size: 0.9rem;
}

.message-list {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 16px;
}

.message {
  max-width: min(620px, 88%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
}

.message.is-mine {
  justify-self: end;
  background: #ecfdf5;
}

.message.is-offer {
  border-color: rgba(15, 118, 110, 0.34);
}

.message p {
  margin: 0 0 6px;
  line-height: 1.45;
}

.offer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  padding: 0 9px;
  background: #ecfdf5;
  color: var(--good);
  font-size: 0.78rem;
}

.offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 9px 0 6px;
}

.message-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  margin: 9px 0;
}

.message-photo-grid a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e5e7eb;
}

.message-photo-grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: block;
  object-fit: cover;
}

.offer-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--good);
  color: #ffffff;
  font-weight: 950;
  cursor: pointer;
}

.offer-actions button + button {
  background: #ffffff;
  color: var(--ink);
}

.message span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.reply-form textarea {
  min-height: 48px;
  border: 1px solid rgba(23, 32, 42, 0.16);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
}

.reply-form button,
.contact-seller-button,
.contact-seller-send {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--good);
  color: #ffffff;
  font-weight: 950;
  cursor: pointer;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
}

.contact-seller-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 18, 28, 0.68);
}

.contact-modal.is-open {
  display: flex;
}

.contact-card {
  width: min(520px, 100%);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.contact-card h2 {
  margin: 0 0 8px;
}

.contact-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.contact-card textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid rgba(23, 32, 42, 0.16);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.contact-cancel {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
}

@media (max-width: 760px) {
  .inbox-panel {
    grid-template-columns: 1fr;
  }

  .thread-list {
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .reply-form {
    grid-template-columns: 1fr;
  }
}
