:root {
  --ink: #1d2433;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --brand: #1f5f8b;
  --brand-dark: #174a6c;
  --ok: #157f3b;
  --ok-bg: #e7f6ec;
  --err: #b42318;
  --err-bg: #fdecea;
  --warn: #9a6700;
  --warn-bg: #fff6e0;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* Заглавие */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: .7rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.brand span { color: var(--brand); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a {
  padding: .35rem .65rem; border-radius: 6px; color: var(--ink); font-size: .92rem;
}
.nav a:hover, .nav a.active { background: var(--bg); text-decoration: none; }
.nav a.active { color: var(--brand); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: .6rem; font-size: .88rem; }
.userbox form { margin: 0; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.narrow { max-width: 520px; }
.mid { max-width: 820px; }
.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 2rem 1rem; }
.footer a { color: var(--muted); }

/* Картички и панели */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem;
}
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem;
  color: var(--ink);
}
.stat:hover { text-decoration: none; border-color: var(--brand); }
.stat b { display: block; font-size: 1.6rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.alert b { color: var(--err); }

/* Пораки */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.errors { background: var(--err-bg); color: var(--err); padding: .75rem 1rem .75rem 2rem; border-radius: 8px; }

/* Форми */
label { display: block; font-weight: 600; font-size: .88rem; margin: .8rem 0 .3rem; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; margin: .5rem 1rem .3rem 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date],
input[type=tel], input[type=file], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #cfd4dc; border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b3d4ea; border-color: var(--brand); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 1rem; }
.hint { color: var(--muted); font-size: .82rem; margin-top: .25rem; }
.actions { margin-top: 1.25rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--brand); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn.link { background: none; border: none; color: var(--brand); padding: 0; font-weight: 400; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.toolbar > * { flex: 0 0 auto; }
.toolbar input[type=search] { width: 260px; }
.toolbar select { width: auto; }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .4rem .8rem; border-radius: 6px; background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Табели */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #fafbfc; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; white-space: nowrap; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--bg); display: block; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.grey { background: #eef0f3; color: var(--muted); }

/* Каталог (картички) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; color: var(--ink);
}
.card:hover { text-decoration: none; border-color: var(--brand); }
.card-img { aspect-ratio: 1 / 1; background: #f0f2f5; display: flex; align-items: center; justify-content: center; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .noimg { color: var(--muted); font-size: .85rem; }
.card-body { padding: .8rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.card-title { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.price { font-size: 1.15rem; font-weight: 700; }
.price-sub { font-size: .8rem; color: var(--muted); }

.product-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
.gallery-main { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.gallery-thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.gallery-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }
.desc { white-space: pre-line; }
.price-table td { padding: .4rem 0; border: none; }
.price-table td:last-child { text-align: right; font-weight: 600; }

.admin-images { display: flex; gap: .75rem; flex-wrap: wrap; }
.admin-images figure { margin: 0; text-align: center; }
.admin-images img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }

.pager { display: flex; gap: .4rem; margin-top: 1rem; align-items: center; flex-wrap: wrap; }
.qr { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 8px; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: .15rem .4rem; border-radius: 4px; word-break: break-all; }

.hero { text-align: center; padding: 3rem 1rem 2rem; }
.hero h1 { font-size: 2rem; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto 1.5rem; font-size: 1.05rem; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.demo-banner { background: var(--warn-bg); color: var(--warn); text-align: center; padding: .5rem 1rem; font-size: .9rem; }

@media (max-width: 760px) {
  .row, .row3, .row4, .product-layout { grid-template-columns: 1fr; }
  .toolbar input[type=search] { width: 100%; }
  .hero h1 { font-size: 1.5rem; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
}
.card-body .badge { align-self: flex-start; }
.toolbar h1 { margin: 0; }
.toolbar { align-items: center; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; margin: 1rem 0 .3rem; }
label.check input { margin-top: .25rem; flex: 0 0 auto; }
@media (max-width: 760px) {
  .topbar-inner { gap: .5rem; padding: .6rem .75rem; }
  .userbox { margin-left: auto; font-size: .82rem; }
  .userbox .muted { display: none; }
  .nav { order: 3; flex: 0 0 100%; flex-wrap: wrap; }
  .nav a { white-space: nowrap; }
  .nav-more-list { position: static; box-shadow: none; margin-top: .25rem; }
  .wrap { padding: 1rem .75rem 2.5rem; }
  .toolbar > select, .toolbar > .btn { flex: 1 1 auto; }
}
/* Графикони */
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: #e4e7ec; stroke-width: 1; }
.chart-axis { fill: #667085; font-size: 11px; font-family: inherit; }
.chart-fill { fill: #2a78d6; }
.chart-bar:hover .chart-fill { fill: #1c5cab; }
.stat b { font-size: 1.35rem; white-space: nowrap; }
pre.code { white-space: pre-wrap; padding: .75rem; font-size: .82rem; overflow-x: auto; }
.msg { margin-bottom: .6rem; }
.msg-staff { border-left: 4px solid var(--brand); }
.msg-client { border-left: 4px solid var(--line); }
.thumb.lg { width: 96px; height: 96px; }
.inline-input { width: 110px !important; display: inline-block; padding: .35rem .5rem !important; }
input[type=color] { width: 100%; height: 42px; padding: 2px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; }
ol.steps { padding-left: 1.2rem; }
ol.steps li { margin: .35rem 0; color: var(--muted); }
ol.steps li.done { color: var(--ok); font-weight: 600; }

/* Помошни класи (наместо inline style, кој CSP го блокира) */
.m-0 { margin:0; }
.mt-0 { margin-top:0; }
.u-15bbcb { margin:.4rem 0 0; }
.u-3ba25b { margin-top:.6rem; }
.u-4f1589 { width:auto; }
.u-89ac00 { min-height:70px !important; }
.u-9dae1d { margin-top:1rem; }
.u-b33383 { margin-top:.75rem; }
.w-100 { width:100px !important; flex: 0 0 auto; }
.w-140 { width:140px !important; flex: 0 0 auto; }
.w-160 { width:160px !important; flex: 0 0 auto; }
.w-180 { width:180px !important; flex: 0 0 auto; }
.w-200 { width:200px !important; flex: 0 0 auto; }
.w-240 { width:240px !important; flex: 0 0 auto; }
.w-80 { width:80px !important; flex: 0 0 auto; }
.w-90 { width:90px !important; flex: 0 0 auto; }
.w-70 { width:70px !important; flex: 0 0 auto; }
.w-120 { width:120px !important; flex: 0 0 auto; }

/* Мени „Повеќе“ и мали објаснувања (без JavaScript-зависност) */
.nav-more { position: relative; }
.nav-more > summary { list-style: none; cursor: pointer; padding: .4rem .7rem; border-radius: 6px; color: var(--ink); }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: " ▾"; font-size: .8em; }
.nav-more[open] > summary, .nav-more > summary:hover { background: var(--bg); }
.nav-more-list {
  position: absolute; left: 0; top: 100%; min-width: 220px; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: .3rem; display: flex; flex-direction: column;
}
.nav-more-list a { display: block; }
.help { display: inline-block; position: relative; vertical-align: middle; margin-left: .25rem; }
.help > summary {
  list-style: none; cursor: pointer; width: 1.15rem; height: 1.15rem; line-height: 1.15rem;
  text-align: center; border-radius: 50%; background: var(--brand); color: #fff; font-size: .75rem; font-weight: 700;
}
.help > summary::-webkit-details-marker { display: none; }
.help-text {
  position: absolute; left: 0; top: 1.5rem; z-index: 15; width: 260px; max-width: 70vw;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.14); padding: .6rem .75rem; font-size: .85rem; font-weight: 400; line-height: 1.4; white-space: normal;
}
.steps { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: .5rem 0 1rem; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; }
.step .num-badge { display: inline-block; width: 1.7rem; height: 1.7rem; line-height: 1.7rem; text-align: center; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; margin-bottom: .4rem; }
.step.done .num-badge { background: #2e9e5b; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { padding: .55rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.todo-list li:last-child { border-bottom: 0; }
.todo-list .badge { min-width: 2rem; text-align: center; }
.glossary dt { font-weight: 700; margin-top: .8rem; }
.glossary dd { margin: .15rem 0 0; color: var(--ink); }

/* ===== 1.10.1: странично мени (dashboard) ===== */
.topbar-inner { max-width: none; padding: .6rem 1.25rem; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); align-items: start; min-height: calc(100vh - 56px); }
.layout > .wrap { max-width: 1200px; width: 100%; margin: 0 auto; }
.sidebar {
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  background: #16324a; color: #dbe6f0; padding: .75rem .6rem 2rem;
}
.side-group {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #8fb0cc;
  margin: 1.1rem .6rem .35rem; font-weight: 700;
}
.side-link {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 8px;
  color: #e8f0f7; font-size: .95rem; margin-bottom: 2px;
}
.side-link:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.side-link.active { background: #fff; color: #16324a; font-weight: 600; }
.side-icon { width: 1.4rem; text-align: center; font-size: 1.05rem; }
.side-label { flex: 1; }
.side-count {
  background: #e8833a; color: #fff; border-radius: 999px; font-size: .75rem; font-weight: 700;
  min-width: 1.4rem; padding: 0 .4rem; text-align: center; line-height: 1.4rem;
}
.side-link.active .side-count { background: #e8833a; }
.menu-toggle {
  display: none; border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  font-size: 1.3rem; line-height: 1; padding: .35rem .6rem; cursor: pointer; color: var(--ink);
}
.sidebar-backdrop { display: none; }
@media (max-width: 900px) {
  .layout { display: block; }
  .menu-toggle { display: inline-block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: 270px; z-index: 50;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .topbar-inner { flex-wrap: nowrap; }
}
.topbar-inner .userbox { margin-left: auto; }
.w-100p { width: 100%; height: auto; border-radius: 8px; }

/* Групи и подгрупи (1.12.0) */
.cat-name { display: flex; align-items: center; gap: .4rem; }
.cat-name input { margin: 0; }
.cat-d1 { padding-left: 1.2rem; } .cat-d2 { padding-left: 2.4rem; } .cat-d3 { padding-left: 3.6rem; }
tr.cat-root td { background: #fafbfc; }
tr.cat-root .cat-name input { font-weight: 700; }
.del-box { display: inline-block; position: relative; vertical-align: middle; }
.del-box > summary { list-style: none; display: inline-block; cursor: pointer; }
.del-box > summary::-webkit-details-marker { display: none; }
.del-form { position: absolute; right: 0; top: 2.2rem; z-index: 20; width: 290px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; box-shadow: 0 8px 24px rgba(0,0,0,.15); white-space: normal; }
.btn.danger-bg { background: var(--err); color: #fff; }
.btn.link.danger { color: var(--err); }
.mt-1 { margin-top: 1rem; }
.publish-box { border: 2px solid var(--brand); background: #f3f8fc; }
.publish-box h2 { margin-top: 0; }

/* Брзо уредување во табелата (1.14.0) */
.pair { display: flex; gap: .25rem; }
.pair input { width: 72px; margin: 0; padding: .3rem .35rem; font-size: .85rem; }
.pair { flex-direction: column; gap: .2rem; }
@media (min-width: 1600px) { .pair { flex-direction: row; } .pair input { width: 80px; } }
.pair input:last-child { background: #f6f8fa; }
td select[data-f] { min-width: 0; max-width: 130px; margin: 0; padding: .3rem; font-size: .85rem; }
.ok-t { color: var(--ok); } .err-t { color: var(--err); }
.loading { opacity: .5; transition: opacity .15s; }
.price-tag { font-size: .7rem; font-weight: 500; color: var(--muted); }
td select[data-f="stock_status"] { min-width: 120px; }
.toolbar input[type=date] { width: auto; margin: 0; padding: .35rem .5rem; }
/* 1.15.0 — цена на барање, рок на испорака */
.flash.info { background: #eef4ff; color: #1d3f72; }
.on-request { color: #8a5a00; }
.price.on-request { font-size: 1rem; }
.delivery { font-size: .85rem; color: var(--muted, #555); margin-top: .3rem; }
.contact-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .3rem 0 .8rem; }
.chip { display: inline-block; padding: .3rem .7rem; border-radius: 999px; background: #f1f3f6; color: inherit; text-decoration: none; font-size: .88rem; }
.chip b { margin-left: .25rem; }
.chip.active { background: #1f4e79; color: #fff; }
.card-link { color: inherit; text-decoration: none; display: flex; flex-direction: column; flex: 1; }
.card-link:hover { text-decoration: none; }
.card-ask { padding: 0 .8rem .7rem; }
.ask-box { margin: .6rem 0; }
.ask-box.compact { display: inline; margin: 0; }
.ask-box.compact .contact-row { display: inline-flex; margin-top: .25rem; }
.ask-title { font-weight: 600; }
.btn.viber { background: #7360f2; border-color: #7360f2; color: #fff; }
.btn.whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.inline-form { display: inline; margin: 0; }
.card-ask .inline-form .btn { margin-top: 2px; }
.panel .big { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.center { text-align: center; } .infinite-more { text-align: center; padding: 18px 0; }
tr.warn td { background: var(--warn-bg); }
.badge.feat { background: #fff4d6; color: #8a5a00; border: 1px solid #f0c674; }
.badge.pre { background: #e8f1f8; color: #1f5f8b; border: 1px solid #a9cde6; }
.badge.new { background: #e7f6ec; color: #157f3b; border: 1px solid #a7dcb9; }

/* Групи и подгрупи (1.24.1) — колоните да не се поклопуваат */
.cats-table td, .cats-table th { vertical-align: top; }
.cats-table td select, .cats-table td input[type=text] { width: 100%; min-width: 8rem; }
.cats-table td.ship-cell { white-space: normal; min-width: 11rem; }
.cats-table td.ship-cell select { display: block; width: 100%; margin: 0 0 .25rem; }
.cats-table td.ship-cell select:last-child { margin-bottom: 0; }
.cats-table td.sort-cell { white-space: nowrap; min-width: 8.5rem; }
.cats-table td.sort-cell .movers { display: inline-flex; gap: .15rem; margin-bottom: .25rem; }
.cats-table td.sort-cell .movers .btn { padding: .2rem .45rem; line-height: 1; }
.cats-table td.acts-cell { white-space: nowrap; min-width: 11rem; text-align: right; }
.cats-table td.acts-cell .btn { margin-bottom: .25rem; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: .6rem 0; z-index: 5; }
