:root {
  --ink: #0a0a0a;
  --paper: #ffffff;
  --line: #e2e2e2;
  --mute: #6b6b6b;
  --surface: #f5f5f5;
  --alert: #c1121f;
  --canvas: 1920px;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

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

::selection {
  background: var(--ink);
  color: var(--paper);
}

.canvas {
  max-width: var(--canvas);
  margin: 0 auto;
  padding: 0 24px;
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-left {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-logo {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-links {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--mute);
}
.nav-links a:hover {
  color: var(--ink);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

footer.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--line);
  padding: 24px 0;
  font-size: 12px;
  color: var(--mute);
}

/* Typography helpers */
.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
}
.mute {
  color: var(--mute);
}
.alert-text {
  color: var(--alert);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s, background-color 0.15s;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}
.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-full {
  width: 100%;
}

/* Cards / containers */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: 24px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.badge-muted {
  border-color: var(--line);
  color: var(--mute);
}
.badge-alert {
  border-color: var(--alert);
  color: var(--alert);
}

/* Forms */
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
  margin-bottom: 4px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  background: var(--paper);
  outline: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
}
.field .hint {
  font-size: 11px;
  color: var(--mute);
  margin-top: 4px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--line);
}
tr:last-child td {
  border-bottom: none;
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-wrap table {
  margin: 0;
}
.table-wrap th:first-child,
.table-wrap td:first-child {
  padding-left: 16px;
}
.table-wrap thead tr {
  background: var(--surface);
}

/* Marketplace grid */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.listing-card {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.listing-card:hover img {
  transform: scale(1.03);
}
.listing-photo {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--surface);
}
.listing-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  transition: transform 0.2s;
}
.photo-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  border: 1px solid var(--ink);
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.photo-tag.right {
  left: auto;
  right: 12px;
}
.photo-tag.urgent {
  border-color: var(--alert);
  background: var(--alert);
  color: var(--paper);
}
.listing-body {
  padding: 16px;
}
.listing-price {
  font-size: 18px;
  font-weight: 600;
}
.blur-locked {
  filter: blur(6px);
  user-select: none;
}
.restricted-wrap {
  position: relative;
  display: inline-block;
}
.restricted-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
}

.stat-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.stat-tile .value {
  font-size: 22px;
  font-weight: 600;
}

/* Utility layout */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: 2fr 1fr;
  }
}
.stack {
  display: flex;
  flex-direction: column;
}
.gap-sm > * + * {
  margin-top: 8px;
}
.gap-md > * + * {
  margin-top: 16px;
}
.sticky-top {
  position: sticky;
  top: 96px;
}

/* Chat */
.chat-shell {
  height: 70vh;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .chat-shell {
    grid-template-columns: 320px 1fr;
  }
}
.chat-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.chat-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  cursor: pointer;
}
.chat-list-item:hover,
.chat-list-item.active {
  background: var(--surface);
}
.chat-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: rgba(245, 245, 245, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bubble {
  max-width: 75%;
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 14px;
}
.bubble.mine {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
}
.bubble.theirs {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: var(--paper);
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px;
}
.chat-input-row textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  max-height: 120px;
}
.attach-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: none;
  cursor: pointer;
  font-size: 16px;
}

/* Auth pages */
.auth-shell {
  max-width: 420px;
  margin: 80px auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.hidden {
  display: none !important;
}
