@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0f1113; --surface: #181b1f; --surface-2: #22262b; --border: #2e333a;
  --fg: #e8e6e1; --muted: #9aa0a6; --accent: #f0691e; --accent-hover: #ff7f33;
  --steel: linear-gradient(135deg, #3a3f46, #1c1f23);
  --heading: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; font: 16px/1.5 Inter, system-ui, sans-serif; background: var(--bg); color: var(--fg); }
h1, h2, h3, legend { font-family: var(--heading); text-transform: uppercase; letter-spacing: .02em; font-weight: 700; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 20px; margin: 0 0 6px; }
a { color: var(--accent); }
header, main, footer { max-width: 1140px; margin: 0 auto; padding: 16px; }

/* Шапка */
nav.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
nav.top h1 { margin: 0; } nav.top a { color: inherit; text-decoration: none; }
nav.top h1::before { content: ''; display: inline-block; width: 26px; height: 26px; margin-right: 10px; vertical-align: -4px; border-radius: 50%;
  background: var(--steel); box-shadow: inset 0 0 0 3px var(--bg), 0 0 0 2px var(--accent); }
header p { color: var(--muted); margin: 6px 0 0; }
.controls { display: flex; gap: 8px; }
.controls select { font: inherit; padding: 6px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); color: var(--fg); }

/* Каталог и корзина */
main { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
main.narrow { grid-template-columns: 1fr; max-width: 560px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-content: start; }
article, aside { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px; }
article { display: flex; flex-direction: column; gap: 4px; transition: border-color .15s; }
article:hover { border-color: var(--accent); }
article .desc { color: var(--muted); margin: 0; }
article .oem { color: var(--muted); font-size: 13px; margin: 0; }
article p:has(strong) { margin: 8px 0; }
article strong { font-family: var(--heading); font-size: 24px; color: var(--accent); letter-spacing: .02em; }
article button { margin-top: auto; }
article small, aside small { color: var(--muted); }
aside { position: sticky; top: 16px; }
aside h2 { margin-top: 0; }
#cart-items { list-style: none; padding: 0; margin: 0 0 12px; }
#cart-items li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
#cart-items li button { padding: 2px 10px; background: var(--surface-2); color: var(--fg); }
#cart-total { font-family: var(--heading); font-size: 22px; color: var(--accent); }

/* Кнопки и формы */
button, .btn { display: inline-block; background: var(--accent); color: #0f1113; border: 0; border-radius: 4px; padding: 11px 18px;
  font: 600 14px/1 var(--heading); font-size: 16px; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; text-decoration: none; text-align: center; }
button:hover, .btn:hover { background: var(--accent-hover); }
button:disabled { opacity: .45; cursor: default; }
a.btn { width: 100%; }
label { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
label span { display: block; margin-bottom: 4px; }
input, .hf { width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 4px; padding: 0 10px; background: var(--surface-2); color: var(--fg); font: inherit; }
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.hf.braintree-hosted-fields-focused { outline: 2px solid var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); margin: 16px 0; padding: 8px 16px 16px; }
legend { padding: 0 6px; font-size: 16px; }
#pay { width: 100%; margin-top: 8px; }
.note { font-size: 13px; color: var(--muted); }
#status { min-height: 1.5em; }

/* Футер и юридические страницы */
footer { color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); margin-top: 40px; }
#legal-links a { margin-right: 10px; color: var(--fg); text-decoration: none; }
#legal-links a:hover { color: var(--accent); }
.legal-page { max-width: 760px; }
.legal-page h2 { margin-top: 0; }
.legal-page h3 { margin-top: 24px; }

@media (max-width: 800px) { main { grid-template-columns: 1fr; } aside { position: static; } }

/* Личный кабинет, админка */
main.single { grid-template-columns: 1fr; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 20px; }
.panel.narrow { max-width: 420px; margin: 0 auto; }
.panel h2 { margin-top: 0; }
.hero { padding: 48px 0 24px; }
.hero h2 { font-size: 40px; max-width: 720px; margin: 0 0 20px; line-height: 1.1; }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px 16px 16px 56px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; font: 700 24px var(--heading); color: var(--accent); }
.btn.ghost, button.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.btn.ghost:hover, button.ghost:hover { border-color: var(--accent); background: transparent; }
textarea { width: 100%; border: 1px solid var(--border); border-radius: 4px; padding: 10px; background: var(--surface-2); color: var(--fg); font: inherit; resize: vertical; }
textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
select { font: inherit; padding: 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); color: var(--fg); }
.row.three { grid-template-columns: 1fr 1fr 110px; }
.err { color: #ff6b6b; min-height: 1.4em; margin: 8px 0 0; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.list { list-style: none; padding: 0; margin: 0; } .list li { padding: 10px 0; border-bottom: 1px solid var(--border); } .list a { color: var(--fg); text-decoration: none; font-weight: 600; }
.badge { display: inline-block; font: 600 12px/1 Inter, sans-serif; letter-spacing: .03em; text-transform: uppercase; padding: 4px 8px; border-radius: 3px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); vertical-align: middle; }
.badge.new, .badge.issued { color: var(--accent); border-color: var(--accent); }
.badge.quoted { color: #ffd166; border-color: #ffd166; }
.badge.paid, .badge.settled, .badge.shipped { color: #7bd88f; border-color: #7bd88f; }
.badge.cancelled, .badge.failed, .badge.refunded { color: #ff6b6b; border-color: #ff6b6b; }
.thread { max-height: 420px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.msg { max-width: 85%; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.msg.customer { align-self: flex-end; border-color: #3a3f46; }
.msg.manager { align-self: flex-start; border-left: 3px solid var(--accent); }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 13px; border: 0; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; } .msg .when { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; align-items: end; }
.invoice { border: 1px solid var(--border); border-radius: 6px; padding: 14px; margin-bottom: 14px; background: var(--surface-2); }
.invoice h3 { margin: 0 0 8px; }
.invoice ul { margin: 0 0 8px; padding-left: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; white-space: nowrap; }
tfoot td { border-bottom: 0; }
tr.total td { font-family: var(--heading); font-size: 20px; color: var(--accent); }
#requests tbody tr { cursor: pointer; } #requests tbody tr:hover { background: var(--surface-2); }
#items input { height: 36px; }
@media (max-width: 800px) { .two { grid-template-columns: 1fr; } .hero h2 { font-size: 30px; } .row.three { grid-template-columns: 1fr; } }

/* Витрина */
.product img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.product .noimg { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--steel); border-radius: 4px; color: var(--muted); font: 600 13px var(--mono, monospace); letter-spacing: .05em; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.cart-line .qty { display: inline-flex; align-items: center; gap: 6px; }
.cart-line .qty button { padding: 2px 9px; }
.cart-line .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
header p.muted { margin-top: 6px; }
.product-admin img { width: 72px; height: 54px; object-fit: cover; border-radius: 4px; }
label.inline { display: flex; align-items: center; gap: 8px; }
label.inline input { width: 18px; height: 18px; }

[hidden] { display: none !important; }

/* ===== Визуальная полировка: hero, движение, hover ===== */
body { background-image: radial-gradient(900px 420px at 15% -10%, rgba(240,105,30,.14), transparent 60%), radial-gradient(700px 400px at 100% 0%, rgba(141,148,156,.08), transparent 60%); background-attachment: fixed; }
header { position: relative; }
header::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px; background: linear-gradient(90deg, var(--accent), transparent 60%); opacity: .6; }
nav.top h1::before { transition: box-shadow .25s, transform .25s; }
nav.top h1:hover::before { transform: rotate(90deg); box-shadow: inset 0 0 0 3px var(--bg), 0 0 0 2px var(--accent), 0 0 18px rgba(240,105,30,.6); }
.hero { position: relative; padding: 56px 0 28px; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: -40px -10% auto auto; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(240,105,30,.25); box-shadow: inset 0 0 0 40px rgba(240,105,30,.04), inset 0 0 0 41px rgba(240,105,30,.15); pointer-events: none; animation: spin 60s linear infinite; }
.hero h2 { position: relative; background: linear-gradient(90deg, var(--fg), #cfd4d9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero h2::after { content: ''; display: block; width: 72px; height: 4px; margin-top: 18px; background: var(--accent); border-radius: 2px; transform-origin: left; animation: grow .8s .3s cubic-bezier(.2,.8,.2,1) both; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
main > *, .hero, .steps li, .grid > article { animation: rise .55s cubic-bezier(.2,.8,.2,1) both; }
.steps li:nth-child(1), .grid > article:nth-child(1) { animation-delay: .05s; }
.steps li:nth-child(2), .grid > article:nth-child(2) { animation-delay: .12s; }
.steps li:nth-child(3), .grid > article:nth-child(3) { animation-delay: .19s; }
.steps li:nth-child(4), .grid > article:nth-child(4) { animation-delay: .26s; }
.grid > article:nth-child(n+5) { animation-delay: .32s; }
.steps li { transition: transform .2s, border-color .2s; }
.steps li:hover { transform: translateY(-3px); border-color: var(--accent); }
article, .panel { transition: transform .22s, border-color .22s, box-shadow .22s; }
.grid > article:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(0,0,0,.35), 0 0 0 1px rgba(240,105,30,.35); }
.product img, .product .noimg { transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.product:hover img, .product:hover .noimg { transform: scale(1.03); }
button, .btn { transition: background .18s, transform .12s, box-shadow .18s; }
button:not(:disabled):hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(240,105,30,.28); }
button:not(:disabled):active, .btn:active { transform: translateY(0); box-shadow: none; }
.btn.ghost:hover, button.ghost:hover { box-shadow: none; }
#legal-links a { position: relative; }
#legal-links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .2s; }
#legal-links a:hover::after { transform: scaleX(1); }
.badge.paid, .badge.settled { box-shadow: 0 0 0 1px rgba(123,216,143,.15), 0 0 12px rgba(123,216,143,.12); }
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 4px rgba(240,105,30,.15); }
.thread .msg { animation: rise .3s both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.controls { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 480px) { nav.top { flex-wrap: wrap; } .controls { width: 100%; } }
