/* Engineering marketplace - one stylesheet for LTR and RTL (logical properties). */
:root {
  --bg: #f5f7fa; --surface: #fff; --text: #1d2733; --muted: #66758a; --line: #dde3ea;
  --brand: #0b5cad; --brand-dark: #084a8c; --accent: #e8f1fb; --ok: #1a7f4b; --warn: #b26a00; --err: #c0392b;
  --radius: 10px; --shadow: 0 1px 3px rgba(20,40,70,.08), 0 4px 16px rgba(20,40,70,.05);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.6;
  font-family: Vazirmatn, "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .6em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; }
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.nowrap { white-space: nowrap; } .center { text-align: center; }
.mt { margin-block-start: 1rem; } .mb { margin-block-end: 1rem; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: embed; text-align: start; }
.mono { font-family: ui-monospace, Consolas, monospace; direction: ltr; unicode-bidi: embed; }

/* header */
.site-header { background: var(--surface); border-block-end: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--brand-dark); }
.brand:hover { text-decoration: none; }
.search { flex: 1 1 240px; display: flex; gap: 6px; max-width: 520px; }
.search input { flex: 1; }
.nav { display: flex; gap: 14px; align-items: center; margin-inline-start: auto; flex-wrap: wrap; }
.nav a, .nav button.linklike { color: var(--text); font-size: .95rem; }
.cart-badge { background: var(--brand); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-inline-start: 4px; }
.catbar { background: var(--surface); border-block-end: 1px solid var(--line); }
.catbar .container { display: flex; gap: 18px; overflow-x: auto; padding-block: 8px; font-size: .92rem; }
.catbar a { color: var(--muted); white-space: nowrap; }
.catbar a:hover { color: var(--brand); }
button.linklike { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--brand); }

/* layout */
main { padding-block: 24px 48px; min-height: 60vh; }
.grid { display: grid; gap: 16px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.split { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .split { grid-template-columns: 2fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin-block-end: .3em; }
.product-card { display: flex; flex-direction: column; gap: 8px; }
.product-card .thumb { aspect-ratio: 16 / 9; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--brand); font-weight: 700; overflow: hidden; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin-block: 28px 12px; }
.hero { background: linear-gradient(135deg, var(--brand), #2a8bdc); color: #fff; border-radius: 14px; padding: 32px 24px; margin-block-end: 8px; }
.hero h1 { color: #fff; } .hero p { max-width: 640px; opacity: .95; }

/* controls */
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid #c5cedb; border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; font-weight: 600; margin-block-end: 4px; font-size: .92rem; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.field { margin-block-end: 14px; }
.help { color: var(--muted); font-size: .82rem; margin-block-start: 3px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.btn { display: inline-block; font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 8px 16px; text-align: center; }
.btn:hover { text-decoration: none; background: #f0f4f9; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: #fff; border-color: var(--err); color: var(--err); }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }
.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* feedback */
.flashes { margin-block-end: 16px; }
.alert { padding: 10px 14px; border-radius: 8px; border: 1px solid; margin-block-end: 8px; }
.alert-success { background: #e8f6ee; border-color: #b6e2c8; color: #14633b; }
.alert-error { background: #fdecea; border-color: #f2b8b1; color: #8f2a20; }
.alert-info { background: var(--accent); border-color: #b9d4f0; color: #0a417a; }
.badge { display: inline-block; font-size: .75rem; padding: 1px 9px; border-radius: 999px; background: #e6ebf2; color: #3a4a60; }
.badge-ok, .badge-paid, .badge-active, .badge-published, .badge-succeeded { background: #dcf3e5; color: var(--ok); }
.badge-warn, .badge-pending, .badge-awaiting_payment, .badge-partially_refunded, .badge-initiated, .badge-draft, .badge-open, .badge-suspended { background: #fdf0d5; color: var(--warn); }
.badge-error, .badge-failed, .badge-cancelled, .badge-revoked, .badge-expired, .badge-refunded { background: #fbe1de; color: var(--err); }
.badge-offer { background: #fde7ee; color: #b3194f; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 9px 12px; text-align: start; border-block-end: 1px solid var(--line); vertical-align: top; }
th { background: #f0f4f9; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-block-end: 0; }
.total-row td { font-weight: 700; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.price { font-weight: 700; color: var(--brand-dark); } .price { white-space: nowrap; } .price s { color: var(--muted); font-weight: 400; margin-inline-start: 6px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-block-start: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pager .current { background: var(--brand); color: #fff; border-color: var(--brand); }
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-block-end: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .value { font-size: 1.6rem; font-weight: 700; color: var(--brand-dark); }
.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery img { border-radius: 8px; border: 1px solid var(--line); }
.license-key { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; letter-spacing: .05em; background: var(--accent); padding: 6px 12px; border-radius: 8px; direction: ltr; display: inline-block; }
.features { padding-inline-start: 20px; margin: 0; }
.prose { white-space: pre-line; }

/* admin */
.admin-layout { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .admin-layout { grid-template-columns: 220px 1fr; } }
.admin-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; align-self: start; }
.admin-nav a { display: block; padding: 7px 12px; border-radius: 6px; color: var(--text); }
.admin-nav a:hover { background: var(--accent); text-decoration: none; }
.admin-nav a.active { background: var(--brand); color: #fff; }
.admin-nav .group { font-size: .75rem; text-transform: uppercase; color: var(--muted); padding: 10px 12px 2px; letter-spacing: .05em; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-block-end: 12px; align-items: end; }
.filters input, .filters select { width: auto; min-width: 140px; }
hr.sep { border: 0; border-block-start: 1px solid var(--line); margin-block: 20px; }
details > summary { cursor: pointer; font-weight: 600; }

/* footer, cookie banner */
.site-footer { border-block-start: 1px solid var(--line); background: var(--surface); padding-block: 20px; color: var(--muted); font-size: .9rem; }
.footer-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; }
.announce { background: #fff7dc; border-block-end: 1px solid #f0dc9c; text-align: center; padding: 6px 12px; font-size: .9rem; }
.cookie-banner { position: fixed; inset-inline: 12px; inset-block-end: 12px; z-index: 50; background: #1d2733; color: #fff; border-radius: 10px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; max-width: 720px; margin-inline: auto; }
.cookie-banner .btn { color: var(--text); }
.hidden { display: none !important; }
.error-page { text-align: center; padding-block: 60px; }
.error-page .code { font-size: 4rem; font-weight: 700; color: var(--brand); }

@media print {
  .site-header, .catbar, .site-footer, .no-print, .cookie-banner { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; }
}
