:root {
  --bg0: #12141a;
  --bg1: #1a1d27;
  --ink: #f2f4f7;
  --muted: #8b93a7;
  --accent: #2ee6d6;
  --accent-ink: #062421;
  --warn: #ffb454;
  --bad: #ff6b7a;
  --good: #5ddea8;
  --line: rgba(242, 244, 247, 0.09);
  --card: #181b24;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --font-display: "Outfit", sans-serif;
  --font-body: "Source Sans 3", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg0);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(46, 230, 214, 0.14), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(46, 230, 214, 0.06), transparent 50%),
    linear-gradient(180deg, #151821 0%, var(--bg0) 42%, #0e1016 100%);
}

.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.hero {
  padding: 4px 2px 14px;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(120deg, #fff 20%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero h1 {
  margin: 10px 0 4px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font: 600 0.92rem var(--font-body);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 1px rgba(46, 230, 214, 0.35), 0 10px 28px rgba(46, 230, 214, 0.18);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn:disabled { opacity: 0.5; cursor: default; }

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0 8px;
}

.ai-meter {
  margin: 0 0 14px;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(46, 230, 214, 0.05);
}

.ai-meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.ai-meter-title {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-meter-count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.ai-meter-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ai-meter-track > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ee6d6, #b8f24a);
  transition: width 0.35s ease;
}

.ai-meter.is-warn .ai-meter-track > i {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.ai-meter.is-crit .ai-meter-track > i {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.ai-meter-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.75rem;
}

.market-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  position: relative;
}

.market-card {
  background: rgba(46, 230, 214, 0.05);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 10px 8px;
}

.market-card-main {
  border-color: rgba(46, 230, 214, 0.45);
  background: rgba(46, 230, 214, 0.1);
}

.market-card .label {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.market-card .value {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.market-meta {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (max-width: 520px) {
  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stat {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 10px 8px;
  box-shadow: none;
}

.stat .label {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.block {
  margin-top: 20px;
}

.inquiries-hero {
  margin-top: 8px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(46, 230, 214, 0.18);
  background: linear-gradient(180deg, rgba(46, 230, 214, 0.06), transparent 70%);
}

.block h2,
.fold summary {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.block-head h2 { margin: 0; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.tabs-time {
  margin: 0 0 12px;
}

.tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 6px 10px;
  font: 500 0.78rem var(--font-body);
  cursor: pointer;
}

.tab.active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.chip strong { color: var(--accent); font-weight: 600; }

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
}

.item:active { transform: scale(0.995); }

.item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.item-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.25;
}

.item-price {
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
  color: var(--accent);
}

.item-price.price-low { color: #3ddea0; }
.item-price.price-mid { color: var(--warn); }
.item-price.price-high { color: var(--bad); }
.item-price.price-unk { color: var(--accent); }

.item-price-wrap {
  text-align: right;
  flex-shrink: 0;
}

.item-published {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.item-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.item-facts {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fact-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1.5px solid transparent;
  background: transparent;
}

.fact-chip.fact-yes {
  color: #3ddea0;
  border-color: #3ddea0;
  background: rgba(61, 222, 160, 0.08);
}

.fact-chip.fact-no {
  color: var(--bad);
  border-color: var(--bad);
  background: rgba(255, 107, 122, 0.08);
}

.fact-chip.fact-unk {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(46, 230, 214, 0.12);
  color: var(--accent);
}

.badge.undervalued { background: rgba(93, 222, 168, 0.15); color: var(--good); }
.badge.overvalued { background: rgba(255, 107, 122, 0.14); color: var(--bad); }
.badge.removed {
  background: rgba(255, 107, 122, 0.16);
  color: var(--bad);
  border: 1px solid rgba(255, 107, 122, 0.45);
}
.item-removed {
  opacity: 0.72;
}
.item-removed .item-title {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.badge.fair { background: rgba(255, 180, 84, 0.14); color: var(--warn); }
.badge.hot, .badge.fast { color: var(--accent); }
.badge.inquiry-need {
  background: rgba(184, 242, 74, 0.12);
  color: var(--accent);
  border: 1px solid rgba(184, 242, 74, 0.35);
}
.badge.inquiry-wait {
  background: rgba(255, 180, 84, 0.16);
  color: var(--warn);
  border: 1px solid rgba(255, 180, 84, 0.35);
}
.badge.inquiry-done {
  background: rgba(93, 222, 168, 0.16);
  color: var(--good);
  border: 1px solid rgba(93, 222, 168, 0.35);
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.thread-msg {
  font-size: 0.86rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-role {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.75;
}

.thread-msg.msg-buyer { color: var(--accent); }
.thread-msg.msg-seller { color: var(--text); }

.item-meta.muted { opacity: 0.65; }
.cons-line { color: var(--bad); }

.ad-card {
  padding: 0;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ad-summary {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.ad-card.open {
  border-color: rgba(46, 230, 214, 0.35);
}
.ad-card.has-inquiry .ad-summary {
  box-shadow: inset 3px 0 0 rgba(255, 180, 84, 0.55);
}
.ad-card.inquiry-unread {
  border-color: rgba(184, 242, 74, 0.9);
  box-shadow:
    0 0 0 1px rgba(184, 242, 74, 0.4),
    0 0 18px rgba(184, 242, 74, 0.14);
}
.ad-card.inquiry-unread .ad-summary {
  box-shadow: inset 3px 0 0 var(--accent);
}
.ad-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.ad-detail {
  padding: 0 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.ad-detail .inq-card {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.empty {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 8px 2px;
}

.error {
  color: var(--bad);
  padding: 12px;
  border: 1px solid rgba(255, 107, 122, 0.3);
  border-radius: 14px;
  background: rgba(255, 107, 122, 0.08);
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.count-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(46, 230, 214, 0.16);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  vertical-align: middle;
  animation: pulseCount 2.4s ease-in-out infinite;
}

@keyframes pulseCount {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 230, 214, 0.0); }
  50% { box-shadow: 0 0 0 6px rgba(46, 230, 214, 0.08); }
}

.inq-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  animation: riseIn 0.35s ease both;
}

.inq-card:nth-child(2) { animation-delay: 0.05s; }
.inq-card:nth-child(3) { animation-delay: 0.1s; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.inq-card .item-title {
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 1.02rem;
}

.inq-card textarea {
  width: 100%;
  min-height: 96px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #10131a;
  color: var(--ink);
  font: 400 0.95rem/1.4 var(--font-body);
  resize: vertical;
}

.inq-card textarea:focus {
  outline: none;
  border-color: rgba(46, 230, 214, 0.55);
  box-shadow: 0 0 0 3px rgba(46, 230, 214, 0.12);
}

.draft-variants {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 8px;
}

.draft-variant {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draft-variant.is-active {
  border-color: rgba(46, 230, 214, 0.55);
  background: rgba(46, 230, 214, 0.1);
  color: var(--accent, #2ee6d6);
}

.inq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn.danger {
  background: rgba(255, 107, 122, 0.14);
  color: var(--bad);
}

.btn.small {
  padding: 9px 13px;
  font-size: 0.84rem;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-body);
}

.btn.linkish {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.manual-box {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 180, 84, 0.1);
  border: 1px solid rgba(255, 180, 84, 0.28);
  color: var(--warn);
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.cond-pill {
  display: inline-block;
  margin-left: 2px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.cond-excellent {
  background: rgba(52, 211, 153, 0.18);
  color: #34d399;
}

.cond-good {
  background: rgba(250, 204, 21, 0.18);
  color: #facc15;
}

.cond-fair {
  background: rgba(251, 146, 60, 0.18);
  color: #fb923c;
}

.cond-poor {
  background: rgba(248, 113, 113, 0.18);
  color: #f87171;
}

.cond-unknown {
  background: rgba(139, 147, 167, 0.16);
  color: var(--muted);
}

.fold {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(24, 27, 36, 0.55);
}

.fold summary {
  margin: 0;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
}

.fold summary::-webkit-details-marker { display: none; }

.fold summary::after {
  content: "+";
  float: right;
  color: var(--accent);
  font-weight: 700;
}

.fold[open] summary {
  margin-bottom: 10px;
}

.fold[open] summary::after { content: "–"; }

.fold .list,
.fold .chips {
  margin-top: 4px;
}
