:root {
  --ink: #1f1d1a; --muted: #6f6a62; --line: #e6e1d8; --paper: #faf8f4; --card: #fff;
  --accent: #d4572a; --accent-d: #b04420; --ok: #2f7d4f; --bad: #b3261e; --warn: #fff4e0;
  --r: 12px; --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--paper); }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.8rem; line-height: 1.2; margin: .4em 0 .6em; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.6em 0 .6em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row.tight { gap: 6px; align-items: center; flex-wrap: nowrap; justify-content: flex-end; }
.inline { display: inline; }

/* header */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -.02em; }
.brand::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); margin-right: 8px; transform: rotate(45deg); }
.topbar nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.topbar nav a, .topbar nav .link { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: var(--muted); font: inherit; }
.topbar nav a:hover, .topbar nav a.on, .topbar nav .link:hover { color: var(--ink); background: var(--paper); }
.pill { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-size: .8rem; text-align: center; }
.foot { border-top: 1px solid var(--line); margin-top: 60px; padding: 24px 0; color: var(--muted); font-size: .9rem; }
.foot .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* buttons & forms */
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { color: var(--bad); border-color: #f0c9c6; margin-top: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { border: 0; background: none; cursor: pointer; }
label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .92rem; }
label small, fieldset small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input[type=checkbox] { display: inline; width: auto; margin: 0 8px 0 0; }
input[type=file] { padding: 7px; }
label.check { display: flex; align-items: center; font-weight: 500; }
.xs { width: 64px; margin: 0; padding: 5px 8px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px 6px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; font-size: .92rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; }
.panel.narrow { max-width: 360px; margin: 12vh auto; }
.panel.row label { margin: 0; flex: 1; min-width: 140px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.cols2.top { align-items: start; gap: 0 28px; }
.hp { position: absolute; left: -9999px; }
.flash { background: #eef6f0; border: 1px solid #cfe5d6; padding: 10px 14px; border-radius: 10px; margin: 16px 0 0; }
.flash.err { background: #fbeceb; border-color: #f0c9c6; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 16px; font-size: .94rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fcfbf8; font-weight: 700; }
tfoot th { background: #fcfbf8; }
tbody tr:last-child td { border-bottom: 0; }
td a { text-decoration: none; } td a:hover { text-decoration: underline; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--bad); font-weight: 700; }
.pos { color: var(--ok); }
tr.dim td { opacity: .6; }
.mini { width: 56px; }
.mini img, .mini .ph { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.mini.big img, .mini.big .ph { width: 96px; height: 96px; margin-top: 22px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat span { display: block; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }
.stat.warn { background: var(--warn); border-color: #f1d9a8; }
.stat.inline { display: inline-block; min-width: 220px; margin-bottom: 12px; }
.filters a { display: inline-block; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; margin: 0 6px 6px 0; font-size: .9rem; background: var(--card); }
.filters a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge { display: inline-block; font-size: .76rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #efebe4; color: var(--muted); }
.badge.ok { background: #e5f2e9; color: var(--ok); }
select.st-noua { background: #fff4e0; } select.st-livrata { background: #e5f2e9; } select.st-anulata { background: #f3f0ea; }

/* BOM */
.bom-row { display: grid; grid-template-columns: 1fr 140px 36px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.bom-row select, .bom-row input { margin: 0; }

/* public */
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 8px; letter-spacing: -.03em; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -12px rgba(0,0,0,.18); }
.thumb { aspect-ratio: 1; background: #f1ede6; display: block; }
.thumb img, .thumb .ph { width: 100%; height: 100%; object-fit: cover; }
.ph { display: grid; place-items: center; color: #c9c1b4; background: #f1ede6; }
.ph svg { width: 40%; max-width: 90px; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h3 { margin: 0; font-size: 1.02rem; }
.card h3 a { text-decoration: none; }
.card .btn { margin-top: auto; width: 100%; }
.price { font-weight: 800; font-variant-numeric: tabular-nums; }
.price.big { font-size: 1.6rem; margin: 0 0 8px; color: var(--accent-d); }
.about { max-width: 640px; margin: 48px auto 0; text-align: center; color: var(--muted); }
.detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; align-items: start; }
.detail-img { border-radius: 16px; overflow: hidden; aspect-ratio: 1; background: #f1ede6; }
.detail-img img, .detail-img .ph { width: 100%; height: 100%; object-fit: cover; }
.desc { margin: 16px 0 24px; }
.buy { display: flex; gap: 10px; }
.buy input { width: 80px; margin: 0; }
.cart td { vertical-align: middle; }
#order-form { max-width: 560px; }

@media (max-width: 760px) {
  .cols2, .cols3, .cols2.top, .detail { grid-template-columns: 1fr; }
  table.products th:nth-child(1), table.products td:nth-child(1), table.products th:nth-child(7), table.products td:nth-child(7) { display: none; }
  table { display: block; overflow-x: auto; }
  .bom-row { grid-template-columns: 1fr 100px 30px 36px; }
}
.panel > h2:first-of-type { margin-top: 0; }
main.wrap { padding-top: 12px; }

/* ---------- v2: categorii, poze, culori, raport ---------- */
.small { font-size: .88rem; }
a.stat { text-decoration: none; display: block; }
a.stat:hover { border-color: var(--ink); }
.row.tight.left { justify-content: flex-start; }
.row.tight input:not(.xs) { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 24px; }
.chips a { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); text-decoration: none; font-weight: 600; font-size: .92rem; }
.chips a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.cat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.dots { display: inline-flex; gap: 4px; align-items: center; vertical-align: middle; }
.dots i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.dots small { color: var(--muted); font-size: .75rem; }
.crumbs { color: var(--muted); }
.crumbs a { color: var(--muted); }
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumbs button { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; width: 68px; height: 68px; cursor: pointer; background: none; }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.swatches { border: 0; padding: 0; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 10px; }
.swatches legend { padding: 0; margin-bottom: 8px; font-weight: 500; }
.swatches label { margin: 0; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); outline: 2px solid transparent; outline-offset: 3px; }
.swatches input:checked + span { outline-color: var(--ink); }
.swatches input:focus-visible + span { outline-color: var(--accent); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.img-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.img-grid img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.img-grid figcaption { display: flex; justify-content: space-between; align-items: center; padding: 4px; gap: 4px; }
.img-grid figcaption form { margin: 0; }
.variants { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.variant { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.variant.dim { opacity: .65; }
.variant input, .variant select { margin: 0; width: auto; }
.variant input[name=name] { flex: 1; min-width: 110px; }
.variant select { max-width: 200px; }
.variant input[type=color] { width: 40px; height: 36px; padding: 2px; }
.variant .check { margin: 0; font-size: .88rem; }
.variant .full { flex-basis: 100%; }
.inline-field { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: .88rem; }
.sm-select { width: auto; margin: 0; padding: 4px 6px; font-size: .85rem; max-width: 120px; }
.sale-row { display: grid; grid-template-columns: 1fr 70px 120px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.sale-row select, .sale-row input { margin: 0; }
.bom-row { grid-template-columns: 1fr 100px 30px 130px 36px; }
.filters-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.filters-bar a { display: inline-block; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; font-size: .9rem; background: var(--card); }
.filters-bar a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters-bar .range { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.filters-bar .range input { width: auto; margin: 0; padding: 5px 8px; }
.chart-wrap { padding: 12px 8px 4px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ytick, .chart .xtick { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(0,0,0,.04); }
@media (max-width: 760px) {
  .bom-row { grid-template-columns: 1fr 80px; }
  .bom-row .unit { display: none; }
  .sale-row { grid-template-columns: 1fr 60px 90px 30px; }
  .filters-bar .range { margin-left: 0; }
}
td.r, th.r { white-space: nowrap; }
.card .btn { text-align: center; }
.variant .inline-field input { width: 64px; flex: none; }
.bom-row { grid-template-columns: 1fr 90px 30px 140px 36px; }
.img-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.img-grid figcaption .btn { padding: 4px 8px; font-size: .8rem; }
.swatches label { position: relative; }
.swatches input { inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
/* personalizare */
.custom-field { margin: 0 0 16px; }
.custom-field input { max-width: 360px; }
.custom-field input.invalid { border-color: var(--bad); outline: 2px solid #f0c9c6; }
.custom-text { display: inline-block; font-weight: 600; color: var(--accent-d); }
.sale-row .custom-in { display: none; grid-column: 1 / -1; }
.sale-row.has-custom .custom-in { display: block; }
