/* CodeNest: KronHub tokens with the CodeNest rose accent. */
:root.nest { --accent: #f2637e; --accent-soft: rgba(242, 99, 126, 0.14); }
@media (prefers-color-scheme: light) {
  :root.nest { --accent: #c4264c; --accent-soft: rgba(196, 38, 76, 0.09); }
}

.nest-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font: 700 1.3rem/1 var(--font-display); text-decoration: none; }
.nest-brand img { width: 30px; height: 30px; }
.nest-brand b { font-weight: 700; }
.nest-brand span { color: var(--accent); }

/* Store */
.store { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }
.store-top { display: flex; align-items: center; gap: 24px; height: 68px; border-bottom: 1px solid var(--line); }
.store-nav { display: flex; gap: 4px; margin-left: 12px; }
.store-nav a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 4px; color: var(--muted); font-weight: 600; text-decoration: none; transition: background-color 0.2s ease, color 0.2s ease; }
.store-nav a:hover { color: var(--fg); }
.store-nav a.on { background: var(--surface-2); color: var(--fg); }
.store-nav svg { width: 13px; height: 13px; }
.store-top .button { margin-left: auto; }

.store-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding: 40px 0 26px; }
.store-head h1 { margin: 0; font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 700; }
.store-head p { margin: 6px 0 0; max-width: 46ch; color: var(--muted); }
.store-perks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; color: var(--prose); font-size: 0.92rem; }
.store-perks li { display: inline-flex; align-items: center; gap: 7px; }
.store-perks svg { width: 15px; height: 15px; color: var(--accent); }

.store-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.cats { position: sticky; top: 20px; display: grid; gap: 2px; }
.cats a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 4px; color: var(--prose); font-weight: 600; text-decoration: none; transition: background-color 0.2s ease, color 0.2s ease; }
.cats a:hover { background: var(--surface); color: var(--fg); }
.cats a.on { background: var(--surface-2); color: var(--fg); }
.cats a.sub { height: 32px; padding-left: 38px; color: var(--muted); font-size: 0.92rem; font-weight: 600; }
.cats a.sub.on, .cats a.sub:hover { color: var(--fg); }
.cats a small { margin-left: auto; color: var(--faint); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.cats svg { width: 17px; height: 17px; color: var(--muted); }
.cats a.on svg { color: var(--accent); }
.cats hr { margin: 8px 0; border: 0; border-top: 1px solid var(--line); }
.cat-chips { display: none; }

.grid-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid-head h2 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.grid-head span { color: var(--faint); font-size: 0.9rem; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.prod { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; transition: border-color 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1); }
.prod:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.prod-img { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; background: var(--bg-deep); background-image: radial-gradient(var(--dot) 1px, transparent 1.3px); background-size: 14px 14px; }
.prod-img img { width: 100%; height: 100%; object-fit: cover; }
.prod-img .ph { width: 38%; max-width: 92px; height: auto; opacity: 0.5; object-fit: contain; }
.prod-img .pill { position: absolute; top: 10px; left: 10px; background: color-mix(in srgb, var(--bg-deep) 82%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.prod-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.prod-body b { font: 700 1.08rem/1.25 var(--font-display); }
.prod-body p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 0.9rem; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.prod-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 10px; }
.prod-price { font: 700 1.25rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.prod-stock { color: var(--faint); font-size: 0.85rem; }
.prod-stock.out { color: var(--bad); font-weight: 600; }
.prod.sold { opacity: 0.6; }
.prod .button { height: 34px; padding: 0 14px; font-size: 0.88rem; }
.store-empty { padding: 56px 20px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); text-align: center; }
.store-empty b { display: block; margin-bottom: 4px; color: var(--fg); font: 700 1.15rem var(--font-display); }
.skel { border-radius: 12px; background: var(--surface); aspect-ratio: 4 / 4.1; animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { 50% { opacity: 0.55; } }

.store-closed { margin: 0 0 18px; }

.nest-footer .socials { display: flex; align-items: center; gap: 14px; }
.nest-footer .socials a { display: inline-flex; align-items: center; gap: 7px; }
.nest-footer .socials svg { width: 18px; height: 18px; }

/* Checkout bits */
.ticket-logo.img { overflow: hidden; padding: 0; }
.ticket-logo.img img { width: 100%; height: 100%; object-fit: cover; }
.desc { margin: 16px 0 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--prose); font-size: 0.95rem; line-height: 1.6; white-space: pre-line; }
.desc:empty { display: none; }
.qty-pick { display: flex; align-items: center; gap: 10px; }
.qty-pick .stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--bg-deep); }
.qty-pick .stepper button { width: 38px; height: 40px; border: 0; background: none; color: var(--fg); font: 700 1.1rem var(--font-body); cursor: pointer; }
.qty-pick .stepper button:disabled { color: var(--faint); cursor: default; }
.qty-pick .stepper input { width: 46px; height: 40px; border: 0; border-inline: 1px solid var(--line); background: none; color: var(--fg); font: 700 1rem var(--font-body); text-align: center; -moz-appearance: textfield; }
.qty-pick .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty-pick small { color: var(--faint); font-size: 0.88rem; }
.items { display: grid; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.items li { display: flex; align-items: flex-start; gap: 8px; padding: 10px 10px 10px 14px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--bg-deep); }
.items code { flex: 1; min-width: 0; padding-top: 5px; font-family: var(--font-code, monospace); font-size: 0.92rem; white-space: pre-wrap; word-break: break-all; }
.items .icon-btn { width: 32px; height: 32px; flex-shrink: 0; }
.seller-note { margin: 0 0 18px; padding: 14px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--prose); white-space: pre-wrap; word-break: break-word; }
.seller-note small { display: block; margin-bottom: 4px; color: var(--accent); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

@media (max-width: 860px) {
  .store-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cats { display: none; }
  .cat-chips { display: flex; gap: 8px; margin: 0 -20px 16px; padding: 0 20px 4px; overflow-x: auto; scrollbar-width: none; }
  .cat-chips::-webkit-scrollbar { display: none; }
  .cat-chips .chip { flex-shrink: 0; text-decoration: none; display: inline-flex; align-items: center; }
  .store-nav { display: none; }
  .store-head { padding-top: 28px; }
}
@media (max-width: 520px) {
  .store { padding-inline: 16px; }
  .cat-chips { margin-inline: -16px; padding-inline: 16px; }
  .products { grid-template-columns: minmax(0, 1fr); }
}

/* Seller dashboard */
.prod-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.thumb { display: grid; flex-shrink: 0; place-items: center; width: 52px; height: 34px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-deep); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb img.ph { width: 20px; height: 20px; object-fit: contain; opacity: 0.6; }
.prod-cell b { display: block; color: var(--fg); font-weight: 600; white-space: normal; }
.prod-cell small { display: block; color: var(--faint); font-size: 0.84rem; }
.icon-pick { display: flex; align-items: center; gap: 14px; }
.icon-pick .thumb { width: 128px; height: 80px; border-radius: 8px; }
.icon-pick .thumb img.ph { width: 34px; height: 34px; }
.icon-pick > div { display: flex; flex-wrap: wrap; gap: 8px; }
.earn { display: grid; gap: 8px; padding: 14px 16px; border-radius: 10px; background: var(--bg-deep); }
.earn .sum-row b.ok { color: var(--ok); }
.owner-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 18px; }
.owner-bar p { margin: 0; }
.owner-bar .button { margin-left: auto; height: 32px; padding: 0 12px; font-size: 0.85rem; }
.wd-amount .button { height: 30px; margin-right: 5px; padding: 0 10px; font-size: 0.82rem; }
.order-items { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.order-items li { padding: 8px 12px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--bg-deep); font-family: var(--font-code, monospace); font-size: 0.88rem; white-space: pre-wrap; word-break: break-all; }
.stock-list { display: grid; gap: 6px; max-height: 260px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.stock-list li { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-deep); }
.stock-list code { flex: 1; min-width: 0; overflow: hidden; font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }
.stock-list .icon-btn { width: 30px; height: 30px; }

/* Order chat */
.chat { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-deep); }
.chat-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-top img { width: 28px; height: 28px; }
.chat-top b { display: block; color: var(--fg); font-size: 0.95rem; }
.chat-top small { display: block; color: var(--faint); font-size: 0.8rem; }
.chat-log { display: flex; flex-direction: column; gap: 10px; height: 340px; padding: 14px; overflow-y: auto; overscroll-behavior: contain; }
.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg .bubble { overflow: hidden; border-radius: 12px; background: var(--surface-2); color: var(--fg); }
.msg.mine .bubble { border-bottom-right-radius: 4px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.msg.theirs .bubble { border-bottom-left-radius: 4px; }
.msg .bubble p { margin: 0; padding: 8px 12px; font-size: 0.93rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg-img { display: block; }
.msg-img img { display: block; max-width: min(260px, 100%); max-height: 260px; object-fit: cover; }
.msg time { margin-top: 3px; padding: 0 4px; color: var(--faint); font-size: 0.74rem; }
.msg.sys { align-self: center; max-width: 92%; }
.msg.sys span { display: block; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--prose); font-size: 0.84rem; text-align: center; overflow-wrap: anywhere; }
.msg.sys.empty span { background: none; color: var(--faint); }
.chat-pic { display: flex; align-items: center; gap: 8px; padding: 8px 14px 0; }
.chat-pic img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 140px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-deep); color: var(--fg); font: 400 0.95rem/1.4 var(--font-body); resize: none; outline: none; }
.chat-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-form .icon-btn { width: 40px; height: 40px; }
.chat-form .icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-form .chat-send { height: 40px; }
.chat-closed { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.85rem; text-align: center; }

/* Checkout sliders */
.range-pick { display: grid; gap: 8px; }
.range-pick .range-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.range-pick .range-top b { font: 700 1.35rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.range-pick .range-top small { color: var(--faint); font-size: 0.85rem; }
.range-pick input[type=range] { width: 100%; height: 22px; margin: 0; background: none; accent-color: var(--accent); cursor: pointer; }
.range-pick .range-ends { display: flex; justify-content: space-between; color: var(--faint); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.guild { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--ok-soft, rgba(95, 207, 142, 0.13)); color: var(--prose); font-size: 0.9rem; }
.guild img { width: 28px; height: 28px; border-radius: 50%; }
.guild b { color: var(--fg); }
.boost-progress { display: grid; gap: 6px; margin: 0 0 18px; }
.boost-progress .bar { height: 6px; overflow: hidden; border-radius: 6px; background: var(--line); }
.boost-progress .bar i { display: block; height: 100%; background: var(--accent); transition: width 0.6s ease; }
.boost-progress small { color: var(--muted); font-size: 0.88rem; }

/* Seller chats */
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.seg-wrap { flex-wrap: wrap; }
.chats-shell { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100dvh - 150px); min-height: 480px; overflow: hidden; padding: 0; }
.chats-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.chats-side .toolbar { flex-direction: column; align-items: stretch; }
.chats-side .seg { align-self: flex-start; }
.chat-list { flex: 1; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.chat-list li { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background-color 0.15s ease; }
.chat-list li:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.chat-list li.on { background: var(--surface-2); }
.chat-list li .thumb { width: 44px; height: 30px; }
.chat-li { flex: 1; min-width: 0; }
.chat-li > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-li b { overflow: hidden; color: var(--fg); font-size: 0.92rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-li time { flex-shrink: 0; color: var(--faint); font-size: 0.75rem; }
.chat-li small { display: block; overflow: hidden; color: var(--faint); font-size: 0.8rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-li p { margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-list li.unread .chat-li p { color: var(--fg); font-weight: 600; }
.chat-list li .side-count, .chat-list li .pill { flex-shrink: 0; align-self: center; margin-left: 0; }
.chat-list .chat-none { justify-content: center; color: var(--faint); cursor: default; }
.chats-main { display: flex; flex-direction: column; min-height: 0; }
.chats-main .empty { margin: auto; }
.thread { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.thread-head .thumb { width: 52px; height: 34px; }
.thread-who { flex: 1; min-width: 0; }
.thread-who b { display: block; overflow: hidden; color: var(--fg); text-overflow: ellipsis; white-space: nowrap; }
.thread-who small { display: block; overflow: hidden; color: var(--faint); font-size: 0.84rem; text-overflow: ellipsis; white-space: nowrap; }
.thread-back { display: none; }
.thread-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--bg-deep); color: var(--muted); font-size: 0.86rem; overflow-wrap: anywhere; }
.thread .chat { flex: 1; min-height: 0; border: 0; border-radius: 0; }
.thread .chat-log { flex: 1; height: auto; min-height: 0; }
@media (max-width: 860px) {
  .chats-shell { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 130px); }
  .chats-shell .chats-main { display: none; }
  .chats-shell.open .chats-side { display: none; }
  .chats-shell.open .chats-main { display: flex; }
  .thread-back { display: inline-grid; }
  .thread-head .button span { display: none; }
  .row3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
}
