/* ==========================================================================
   Prisman - dizayn tizimi
   Fikr: prizma oq nurni spektrga ajratadi. Spektr ranglari kategoriyalarni
   belgilaydi (Plugin = zangori, Map = yashil, Mod = sariq ...), shu sabab
   rang bezak emas, ma'lumot. Shakllar Minecraft bloklariga o'xshash: kichik
   radius, qalin chiziq, bosilganda cho'kadigan tugmalar.
   ========================================================================== */
:root {
  --bg: #0f1126;  --bg2: #141733;  --surface: #1a1d3e;  --raise: #23275a;
  --line: #2f3470;  --line2: #454b94;
  --text: #eef0ff;  --muted: #a3a8d6;
  --cyan: #4fe3ff;  --violet: #8b6bff;  --magenta: #ff5fb0;
  --amber: #ffc857;  --lime: #7dff8a;  --coral: #ff8a5c;  --danger: #ff6b81;
  --spectrum: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta), var(--amber), var(--lime));
  --r: 6px;
  --head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --pixel: "Silkscreen", "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(79, 89, 190, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 89, 190, .08) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text); font: 400 1rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: 0.2s; }
a:hover { color: #fff; }
h1, h2, h3 { font-family: var(--head); line-height: 1.12; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0; }
::selection { background: var(--violet); color: #fff; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- joylashuv ---------- */
.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 20px; }
.wrap.narrow { max-width: 780px; }
.page { padding-block: 36px 56px; }
.page-head { margin-bottom: 28px; display: grid; gap: 10px; }
.page-head p { color: var(--muted); max-width: 62ch; }
.crumb { font-size: .9rem; }
.stack { display: grid; gap: 16px; align-content: start; }
.stack-lg { display: grid; gap: 28px; align-content: start; }
.two { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.two-rev { grid-template-columns: minmax(0, 1fr) 380px; }
.sticky { position: sticky; top: 92px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.panel { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); padding: 22px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 50; background: rgba(15, 17, 38, .9); backdrop-filter: blur(10px); }
.prism-line { height: 3px; background: var(--spectrum); }
.bar { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo span { font: 400 1.35rem var(--pixel); letter-spacing: .02em; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav > a, .linkbtn {
  padding: 8px 12px; border-radius: var(--r); color: var(--muted); text-decoration: none;
  font-weight: 600; position: relative;
}
.nav > a:hover { color: var(--text); background: var(--bg2); }
.nav > a[aria-current="page"] { color: var(--text); background: var(--raise); }
.nav .btn { margin-left: 6px; }
.spacer { flex: 1; }
.dot { position: absolute; top: 6px; right: 4px; width: 9px; height: 9px; border-radius: 2px; background: var(--magenta); }
.count { display: inline-block; min-width: 1.5em; margin-left: .5em; padding: 0 .4em; border-radius: 999px; background: var(--magenta); color: var(--bg); font-size: .75rem; text-align: center; }
.admin-link { color: var(--amber) !important; }
.bal { display: inline-flex; align-items: center; gap: 10px; border: 2px solid var(--line); }
.bal strong { color: var(--cyan); font-weight: 700; }
.inline, .inline-form { display: inline; margin: 0; }
.inline-form { margin-top: 18px; display: block; }
.linkbtn { background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--text); }
.burger { display: none; margin-left: auto; width: 44px; height: 44px; background: none; border: 2px solid var(--line); border-radius: var(--r); cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.burger span { width: 20px; height: 2px; background: var(--text); display: block; }

/* ---------- tugma ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: .72em 1.3em; border: 0; border-radius: var(--r); cursor: pointer;
  font: 700 .98rem var(--body); text-decoration: none; color: var(--bg);
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 3px 0 rgba(0, 0, 0, .45), inset 0 -3px 0 rgba(0, 0, 0, .16);
  transition: transform .02s, box-shadow .08s;
  transition: 0.2s;
}
.btn:hover { color: var(--bg); filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .45), inset 0 -2px 0 rgba(0, 0, 0, .16); }
.btn.sm { padding: .45em .9em; font-size: .9rem; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: none; border: 2px solid var(--line2); }
.btn.ghost:hover { background: var(--raise); color: var(--text); filter: none; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- forma ---------- */
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; padding: 0; }
.hint { color: var(--muted); font-size: .875rem; }
.hint b { color: var(--text); }
input, select, textarea {
  width: 100%; padding: .68em .85em; background: var(--bg2); color: var(--text);
  border: 2px solid var(--line); border-radius: var(--r); font: inherit;
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: #6f75b4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(79, 227, 255, .22); }
input:disabled { opacity: .45; }
input[type="file"] { padding: .5em; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: .5em 1em; border: 0; border-radius: 4px; background: var(--raise); color: var(--text); font-weight: 600; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--cyan); }
.check, .switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.switch input { width: 22px; height: 22px; }
.switch span { font-weight: 600; }
.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick label { position: relative; cursor: pointer; font-weight: 600; }
.cat-pick input { position: absolute; opacity: 0; inset: 0; }
.cat-pick span { display: inline-flex; align-items: center; gap: 8px; padding: .5em .95em; border: 2px solid var(--line); border-radius: var(--r); background: var(--bg2); }
.cat-pick i, .chip i { width: 10px; height: 10px; background: var(--c); display: inline-block; }
.cat-pick input:checked + span { border-color: var(--c); background: var(--raise); }
.cat-pick input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: 2px; }
.preview { max-width: 320px; margin-top: 8px; border: 2px solid var(--line); border-radius: var(--r); }
.balline strong { color: var(--cyan); }
.warn { color: var(--amber); }

/* ---------- xabarlar ---------- */
.flashes { display: grid; gap: 10px; margin-top: 18px; }
.flash { padding: .8em 1em; background: var(--surface); border: 2px solid var(--line); border-left-width: 6px; border-radius: var(--r); }
.flash.ok { border-left-color: var(--lime); }
.flash.error { border-left-color: var(--danger); }
.flash.warn { border-left-color: var(--amber); color: var(--text); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 24px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 36px; align-items: center; }
.hero-copy { display: grid; gap: 20px; }
.hero h1 { font-size: clamp(2.25rem, 5.4vw, 3.8rem); line-height: 1.03; letter-spacing: -.025em; }
.hero-copy p { color: var(--muted); font-size: 1.12rem; max-width: 46ch; }
.hero-art { width: 100%; height: auto; shape-rendering: crispEdges; overflow: visible; }
.beam rect {
  transform-box: fill-box; transform-origin: left center;
  animation: beam .9s steps(9) both; animation-delay: calc(.25s + var(--i) * .09s);
}
@keyframes beam { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- katalog ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters input[type="search"] { flex: 1 1 260px; width: auto; }
.filters select { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: .45em .9em; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; }
.chip small { color: var(--muted); font-weight: 500; }
.chip:hover { border-color: var(--c, var(--cyan)); color: var(--text); }
.chip.on { border-color: var(--c, var(--cyan)); background: var(--raise); }
.notice { margin-bottom: 20px; padding: .7em 1em; background: var(--surface); border-left: 6px solid var(--cyan); border-radius: var(--r); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }
.card { display: flex; flex-direction: column; overflow: hidden; color: var(--text); text-decoration: none; background: var(--surface); border: 2px solid var(--line); border-top: 5px solid var(--c); border-radius: var(--r); }
.card:hover { border-color: var(--c); color: var(--text); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--bg2); }
.thumb img, .cover img { width: 100%; height: 100%; object-fit: cover; }
.price {
  position: absolute; top: 10px; right: 10px; padding: 6px 9px; border-radius: 4px;
  font: 400 .72rem var(--pixel); letter-spacing: .03em;
  background: rgba(15, 17, 38, .94); border: 2px solid var(--line2); color: var(--text);
}
.price.free { background: var(--lime); border-color: var(--bg); color: var(--bg); }
.price.big { top: 14px; right: 14px; font-size: .9rem; padding: 9px 13px; }
.card-body { display: grid; gap: 8px; padding: 16px; align-content: start; flex: 1; }
.card-body p { color: var(--muted); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 10px; color: var(--muted); font-size: .85rem; }
.tag { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .85rem; color: var(--c); }
.tag::before { content: ""; width: 9px; height: 9px; background: var(--c); }
.empty { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 44px 22px; }
.empty p { color: var(--muted); max-width: 46ch; }
.errcode { font: 400 3rem var(--pixel); color: var(--magenta); }

/* ---------- mahsulot sahifasi ---------- */
.item-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.item-main { display: grid; gap: 26px; min-width: 0; }
.cover { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg2); border: 2px solid var(--line); border-top: 5px solid var(--c); border-radius: var(--r); }
.item-head { display: grid; gap: 10px; }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 65ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 2px; margin: 0; background: var(--line); border: 2px solid var(--line); border-radius: var(--r); overflow: hidden; }
.facts > div { background: var(--surface); padding: 12px 14px; }
.facts dt { color: var(--muted); font-size: .82rem; }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.small-facts > div { padding: 8px 12px; }
.desc { display: grid; gap: 12px; }
.prose { white-space: pre-wrap; max-width: 70ch; line-height: 1.75; color: #dfe2ff; overflow-wrap: anywhere; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gallery img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border: 2px solid var(--line); border-radius: var(--r); }
.buybox { position: sticky; top: 92px; display: grid; gap: 14px; border-top: 5px solid var(--c); }
.bb-price { font: 800 2rem var(--head); }
.bb-price.free { color: var(--lime); }

/* ---------- hisob ---------- */
.acct { display: grid; grid-template-columns: 1fr auto auto; gap: 28px; align-items: center; margin-bottom: 30px; }
.acct-bal { display: grid; gap: 2px; }
.acct-bal span { color: var(--muted); font-size: .9rem; }
.acct-bal strong { font: 800 2rem var(--head); color: var(--cyan); }
.tablist { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--line); }
.tablist button { background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: .75em 1.1em; color: var(--muted); font: 600 1rem var(--body); cursor: pointer; }
.tablist button small { color: var(--muted); font-weight: 500; }
.tablist button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--cyan); }
.tabpanel { padding-top: 22px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); }
.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; padding: .75em 1em; color: var(--muted); font-size: .85rem; font-weight: 600; border-bottom: 2px solid var(--line); white-space: nowrap; }
.t th.right { text-align: right; }
.t td { padding: .8em 1em; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t .wide { max-width: 420px; overflow-wrap: anywhere; }
.plus { color: var(--lime); font-weight: 700; }
.minus { color: var(--text); font-weight: 700; }
.st { display: inline-block; padding: .12em .6em; border-radius: 4px; border: 2px solid; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.st-pending { color: var(--amber); border-color: var(--amber); }
.st-approved, .st-paid, .st-done { color: var(--lime); border-color: var(--lime); }
.st-rejected { color: var(--danger); border-color: var(--danger); }
.st-open { color: var(--cyan); border-color: var(--cyan); }
.st-closed { color: var(--muted); border-color: var(--line2); }

/* ---------- to'ldirish / yechish ---------- */
.bankcard { display: grid; gap: 14px; padding: 22px; border-radius: 10px; background: linear-gradient(135deg, #2a3190, #5b34a8 58%, #8a3a9a); border: 2px solid var(--line2); }
.bc-label { font-size: .85rem; opacity: .85; }
.bc-num { font: 400 clamp(1.1rem, 3.6vw, 1.6rem) var(--pixel); letter-spacing: .06em; overflow-wrap: anywhere; }
.bc-owner { font-weight: 600; letter-spacing: .04em; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.reqrow { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.reqrow:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------- zakaz va yordam ---------- */
.order { display: grid; gap: 14px; border-left: 6px solid var(--c); }
.order header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order.is-done { opacity: .62; }
.order-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.order form { display: inline; }
.ticket-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: var(--text); text-decoration: none; }
.ticket-row:hover { border-color: var(--cyan); color: var(--text); }
.ticket-row > div:first-child { display: grid; gap: 2px; min-width: 0; }
.ticket-row .small { overflow: hidden; text-overflow: ellipsis; }
.ticket-meta { display: grid; gap: 4px; justify-items: end; flex-shrink: 0; }
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 480px; overflow-y: auto; padding: 18px; }
.msg { max-width: 82%; padding: 10px 14px; background: var(--raise); border: 2px solid var(--line); border-radius: var(--r); align-self: flex-start; }
.msg b { font-size: .82rem; color: var(--muted); }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0; }
.msg time { font-size: .78rem; color: var(--muted); }
.msg.admin { border-color: var(--violet); }
.msg.mine { align-self: flex-end; background: #2b3170; border-color: var(--cyan); }
.chat-form { display: grid; gap: 12px; margin-top: 16px; }

/* ---------- auth ---------- */
.auth { display: grid; place-items: start center; }
.auth-box { width: min(440px, 100%); }

/* ---------- admin ---------- */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.side { position: sticky; top: 92px; display: grid; gap: 4px; padding: 10px; }
.side a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: var(--r); color: var(--muted); text-decoration: none; font-weight: 600; }
.side a:hover { background: var(--bg2); color: var(--text); }
.side a[aria-current="page"] { background: var(--raise); color: var(--text); }
.admin-main { min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stat { display: grid; gap: 4px; padding: 16px 18px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); }
.stat span { color: var(--muted); font-size: .88rem; }
.stat strong { font: 800 1.45rem var(--head); }
.stat.hot { border-color: var(--lime); }
.stat.hot strong { color: var(--lime); }
.rowact { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.rowact form { display: inline-flex; gap: 6px; }
.note { width: 150px; padding: .4em .6em; font-size: .88rem; }
.cardnum { font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- footer ---------- */
.foot { margin-top: 48px; padding: 28px 0; border-top: 2px solid var(--line); background: rgba(15, 17, 38, .7); }
.foot-in { display: grid; gap: 4px; }

/* ---------- moslashuvchan ---------- */
@media (max-width: 900px) {
  .burger { display: flex; }
  .nav { display: none; position: absolute; top: 67px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 20px 18px; background: var(--bg); border-bottom: 2px solid var(--line); }
  .nav.open { display: flex; }
  .spacer { display: none; }
  .nav .btn { margin: 6px 0 0; }
  .hero-grid, .item-layout, .two, .two-rev, .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 460px; }
  .buybox, .sticky, .side { position: static; }
  .acct { grid-template-columns: 1fr; }
  .side { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 560px) {
  .hero { padding-top: 32px; }
  .msg { max-width: 94%; }
  .ticket-row { flex-direction: column; align-items: flex-start; }
  .ticket-meta { justify-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .beam rect { animation: none; }
  .btn { transition: none; }
}
