:root {
  --bg: #f3efe7;
  --surface: rgba(255, 252, 245, 0.86);
  --surface-strong: #fffaf2;
  --surface-alt: #f4e9da;
  --text: #1e2328;
  --muted: #66707a;
  --line: rgba(30, 35, 40, 0.1);
  --brand: #cc5c32;
  --brand-dark: #933714;
  --shadow: 0 22px 60px rgba(63, 43, 20, 0.12);
  --radius-xl: 32px;
  --radius-lg: 22px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(204, 92, 50, 0.16), transparent 28%),
    radial-gradient(circle at right, rgba(52, 112, 164, 0.12), transparent 30%),
    linear-gradient(180deg, #f8f3ea 0%, #efe5d6 100%);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 248, 238, 0.74);
  backdrop-filter: blur(24px);
  z-index: 21;
}

.sidebar-backdrop {
  display: none;
}

.brand-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 14px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: var(--shadow);
}

.brand-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.brand-logo-image {
  display: block;
  width: 118px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.brand-copy .eyebrow {
  margin-bottom: 6px;
  text-align: center;
}

.brand-block h1,
.section-head h3,
.modal-card h3,
.panel-card h3,
.support-card h3 {
  margin: 0;
  font-family: "Arial Black", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-dark);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-link,
.ghost-button,
.solid-button {
  min-height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.nav-link {
  text-align: left;
  color: var(--text);
  background: transparent;
}

.nav-link:hover,
.ghost-button:hover,
.solid-button:hover,
.store-badge:hover,
.sidebar-meta-link:hover {
  transform: translateY(-1px);
}

.nav-link.is-active {
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line);
}

.sidebar-downloads {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.sidebar-meta {
  display: grid;
  gap: 10px;
}

.sidebar-meta-link {
  padding: 0;
  color: var(--muted);
  text-align: left;
  text-decoration: underline;
  background: transparent;
}

.sidebar-meta-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.main-panel {
  padding: 18px;
}

.topbar,
.panel-card,
.support-panel,
.support-card,
.modal-card,
.drawer-panel,
.listing-card {
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(20px);
}

.mobile-menu-button {
  display: none;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: var(--surface-strong);
}

.mobile-categories-button,
.mobile-support-button,
.mobile-auth-button,
.mobile-sidebar-actions {
  display: none;
}

.search-wrap {
  flex: 1;
}

.search-wrap input,
.filters-bar input,
.filters-bar select,
.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(30, 35, 40, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

input[readonly] {
  color: var(--brand-dark);
  font-weight: 700;
  background: rgba(244, 233, 218, 0.85);
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.solid-button {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}

.hero-text {
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.7;
}

.listing-actions,
.details-actions,
.store-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.split-panels,
.support-layout,
.cards-grid,
.mini-list,
.notification-list {
  display: grid;
  gap: 16px;
}

.support-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.section-note,
.listing-description,
.mini-item p,
.notification-item p,
.info-copy p {
  color: var(--muted);
}

.panel-card,
.support-panel,
.support-card {
  padding: 22px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--line);
}

.catalog-section,
.support-panel {
  margin-top: 18px;
}

.catalog-section {
  display: grid;
  grid-template-rows: auto auto auto;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.filters-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
}

.filters-bar label,
.stack-form label {
  display: grid;
  gap: 8px;
}

.filters-bar span,
.stack-form span {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.cards-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
  max-height: none;
  padding-right: 0;
  overflow-y: visible;
  align-content: start;
}

.cards-grid::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.drawer-panel::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.chat-thread-list::-webkit-scrollbar {
  width: 10px;
}

.cards-grid::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.drawer-panel::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.chat-thread-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(147, 55, 20, 0.26);
}

.listing-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}

.listing-card-media {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #f4d7b6, #dfebe8);
}

.listing-card-media img,
.details-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-badge,
.listing-favorite {
  position: absolute;
  top: 14px;
}

.listing-badge {
  left: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(30, 35, 40, 0.72);
  color: #fff;
  font-size: 0.7rem;
}

.listing-favorite {
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
}

.listing-favorite.is-active {
  color: var(--brand);
}

.listing-card-body {
  padding: 10px 12px;
}

.listing-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.listing-card h4 {
  margin: 6px 0 4px;
  font-size: 0.84rem;
  line-height: 1.3;
}

.listing-price {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 800;
}

.listing-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.listing-specs span,
.meta-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f0e5d5;
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 700;
}

.listing-description {
  font-size: 0.74rem;
  line-height: 1.35;
}

.catalog-more {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.catalog-more .ghost-button,
.catalog-more .solid-button {
  min-width: 132px;
  min-height: 40px;
  font-size: 0.92rem;
}

.catalog-more button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.listing-actions {
  margin-top: 8px;
}

.listing-actions .ghost-button,
.listing-actions .solid-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.split-panels {
  grid-template-columns: 1fr;
  margin-top: 18px;
}

.messages-panel {
  overflow: hidden;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 16px;
}

.chat-thread-list,
.chat-window {
  min-height: 420px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
}

.chat-thread-list {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  overflow-y: auto;
}

.thread-card {
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid transparent;
}

.thread-card.is-active {
  border-color: rgba(204, 92, 50, 0.34);
  background: rgba(255, 243, 234, 0.92);
}

.auth-switch {
  display: flex;
  gap: 10px;
  margin: 0 0 16px;
}

.auth-switch .ghost-button.is-active {
  background: rgba(204, 92, 50, 0.12);
  box-shadow: inset 0 0 0 1px rgba(204, 92, 50, 0.24);
}

.profile-card {
  display: grid;
  gap: 16px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-hero p {
  margin: 6px 0 0;
  color: var(--muted);
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}

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

.thread-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.chat-window {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-window-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.chat-window-head strong,
.chat-window-head span {
  display: block;
}

.chat-window-head span {
  margin-top: 4px;
  color: var(--muted);
}

.chat-messages {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  overflow: auto;
}

.chat-bubble {
  max-width: min(85%, 440px);
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.5;
}

.chat-bubble.partner {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.chat-bubble.self {
  justify-self: end;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}

.chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.mini-item,
.notification-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.mini-item strong,
.notification-item strong {
  display: block;
  margin-bottom: 6px;
}

.support-panel {
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 241, 233, 0.94));
}

.support-banner {
  padding: 16px 24px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--brand-dark) 0%, var(--brand) 48%, #d7774c 100%);
}

.support-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  padding: 22px;
}

.support-card {
  background: rgba(255, 255, 255, 0.88);
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 18px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(180deg, #222933 0%, #0f141b 100%);
  box-shadow: 0 12px 24px rgba(15, 20, 27, 0.18);
}

.store-badge-icon {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
}

.store-badge-text {
  display: grid;
  gap: 2px;
}

.store-badge-text small {
  font-size: 0.76rem;
  opacity: 0.82;
}

.store-badge-text strong {
  font-size: 1.15rem;
}

.upload-field small {
  color: var(--muted);
}

.drawer,
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.modal {
  overflow-y: auto;
  padding: 20px 0;
}

.drawer-backdrop,
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 24, 28, 0.42);
  backdrop-filter: blur(6px);
}

.drawer-panel,
.modal-card {
  position: relative;
  z-index: 1;
}

.drawer-panel {
  margin-left: auto;
  width: min(100%, 560px);
  height: 100%;
  padding: 28px;
  background: #fffaf4;
  overflow-y: auto;
}

.drawer-panel.slim {
  width: min(100%, 420px);
}

.modal-card {
  width: min(100% - 24px, 540px);
  margin: 40px auto;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: #fffaf4;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.modal-card.wide {
  width: min(100% - 24px, 860px);
}

.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(30, 35, 40, 0.08);
  font-size: 1.4rem;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.grid-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
  grid-column: 1 / -1;
}

.details-cover {
  aspect-ratio: 1.55 / 1;
  border-radius: 24px;
  cursor: zoom-in;
}

.details-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.details-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  cursor: pointer;
  border: 1px solid var(--line);
}

.image-modal-card {
  position: relative;
  z-index: 1;
  width: min(100% - 24px, 1100px);
  margin: 24px auto;
  display: grid;
  place-items: center;
}

.fullscreen-image {
  width: 100%;
  max-height: calc(100vh - 48px);
  object-fit: contain;
  border-radius: 24px;
  background: #000;
}

.image-close {
  background: rgba(255, 255, 255, 0.92);
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 240px;
  padding: 14px 16px;
  border-radius: 18px;
  color: #fff;
  background: rgba(30, 35, 40, 0.92);
}

.empty-state {
  padding: 26px 18px;
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.54);
}

.info-copy {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  line-height: 1.7;
}

.policy-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  line-height: 1.6;
}

.policy-doc h2,
.policy-doc h3 {
  margin: 18px 0 10px;
}

.policy-doc p {
  margin: 0 0 10px;
}

.policy-doc ul {
  margin: 0 0 12px 18px;
  padding: 0;
}

.policy-doc li {
  margin: 0 0 6px;
}

.policy-doc a,
.info-copy a {
  color: #1a73e8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 19;
    border: 0;
    background: rgba(18, 24, 28, 0.24);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-button {
    display: inline-grid;
    place-items: center;
  }

  .mobile-categories-button,
  .mobile-support-button,
  .mobile-auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 12px;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .topbar {
    position: sticky;
    top: 10px;
    z-index: 10;
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .topbar .search-wrap {
    order: 5;
    flex: 1 0 100%;
  }

  .mobile-sidebar-actions {
    display: grid;
    gap: 8px;
  }

  .brand-title {
    flex-wrap: wrap;
  }

  .topbar-actions {
    display: none;
  }

  .filters-bar label:first-child {
    display: none;
  }

  .support-layout,
  .chat-layout {
    grid-template-columns: 1fr;
  }

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

  .listing-card {
    grid-template-columns: 140px minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .main-panel {
    padding: 12px;
  }

  .panel-card,
  .support-card,
  .drawer-panel,
  .modal-card {
    border-radius: 24px;
    padding: 18px;
  }

  .cards-grid,
  .filters-bar,
  .grid-form,
  .chat-composer {
    grid-template-columns: 1fr;
  }

  .profile-fields {
    grid-template-columns: 1fr;
  }

  .listing-card {
    grid-template-columns: 94px minmax(0, 1fr);
    border-radius: 14px;
  }

  .listing-card-media {
    min-height: 94px;
  }

  .listing-card-body {
    padding: 8px 9px;
  }

  .listing-meta {
    font-size: 0.71rem;
  }

  .listing-card h4 {
    margin: 4px 0 3px;
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .listing-price {
    margin-bottom: 4px;
    font-size: 0.9rem;
  }

  .listing-specs {
    gap: 4px;
    margin-bottom: 5px;
  }

  .listing-specs span,
  .meta-pill {
    padding: 4px 7px;
    font-size: 0.66rem;
  }

  .listing-description {
    font-size: 0.7rem;
    line-height: 1.28;
  }

  .listing-actions {
    margin-top: 6px;
    gap: 6px;
  }

  .listing-actions .ghost-button,
  .listing-actions .solid-button {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.72rem;
  }

  .listing-badge {
    top: 9px;
    left: 9px;
    padding: 4px 7px;
    font-size: 0.62rem;
  }

  .listing-favorite {
    top: 9px;
    right: 9px;
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
  }

  .support-layout {
    padding: 18px;
  }

  .support-banner {
    padding: 14px 18px;
  }

  .store-badge {
    width: 100%;
  }

  .mobile-support-button {
    display: none;
  }
}
