/* JAM PEHAR admin */
:root {
  --ink: #23262b;
  --ink-2: #2f333a;
  --gold: #c8963e;
  --gold-soft: #f6ecd9;
  --gold-text: #7f5a17;
  --canvas: #eceef1;
  --surface: #ffffff;
  --line: #d9dde2;
  --line-soft: #e8ebee;
  --text: #1d2024;
  --muted: #5f6670;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #1f7a4d;
  --ok-soft: #e5f4ec;
  --info-soft: #e9f0f8;
  --r-sm: 6px;
  --r: 10px;
  --side-w: 248px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --slab: "Zilla Slab", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--canvas); }
img { max-width: 100%; }
a { color: inherit; }
h1, h2 { margin: 0; line-height: 1.2; }
p { margin: 0; }
code { font-size: .9em; background: rgba(0,0,0,.06); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.inline { display: inline; margin: 0; }

/* ---------- layout ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  background: var(--ink); color: #c9cdd3;
  display: flex; flex-direction: column; padding: 20px 12px;
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 22px; }
.brand { display: block; background: #fff; border-radius: var(--r-sm); padding: 8px 12px; line-height: 0; }
.brand img { width: 118px; height: auto; }
.nav { display: grid; gap: 2px; }
.nav a, .side-bottom a, .side-logout {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  text-decoration: none; color: inherit; font: 500 15px/1.2 var(--font); background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
}
.nav a:hover, .side-bottom a:hover, .side-logout:hover { background: var(--ink-2); color: #fff; }
.nav a[aria-current="page"], .side-bottom a[aria-current="page"] { background: var(--ink-2); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav a[aria-current="page"] .i { color: var(--gold); }
.side-bottom { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid #3a3f46; padding-top: 12px; }
.side .side-close { display: none; color: #fff; }

.main-wrap { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 16px 32px; background: rgba(236,238,241,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font: 700 26px/1.15 var(--slab); flex: 1; min-width: 0; }
.topbar-actions { display: flex; gap: 8px; }
.topbar .menu-btn { display: none; }
.content { padding: 24px 32px 64px; display: grid; gap: 20px; align-content: start; max-width: 1180px; width: 100%; }
.lead { color: var(--muted); max-width: 70ch; }
.scrim { display: none; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 600 14px/1.2 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #b9bfc6; }
.btn .i { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; border-color: #000; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--line-soft); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-weight: 600; font-size: 14px; }
.field small { font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input:not([type]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: 15px/1.4 var(--font);
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold-soft); }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.pw { position: relative; display: block; }
.pw input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 40px; height: 38px; cursor: pointer; display: grid; place-items: center; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ---------- alerts & toasts ---------- */
.alert { padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: #1f3b5c; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; border-radius: var(--r-sm); background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(20,22,26,.25); font-weight: 500; animation: toast-in .25s ease-out; }
.toast-success { border-left: 4px solid #52c08a; }
.toast-error { background: var(--danger); }
.toast-info { border-left: 4px solid var(--gold); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { font: 600 16px/1.3 var(--font); }
.panel-head a { font-size: 14px; color: var(--gold-text); font-weight: 600; text-decoration: none; }
.panel-head a:hover { text-decoration: underline; }
.pad { padding: 20px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.empty { background: var(--surface); border: 1px dashed #c3c8ce; border-radius: var(--r); padding: 48px 20px; text-align: center; display: grid; gap: 16px; justify-items: center; }
.deflist { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.deflist dt { color: var(--muted); }
.deflist dd { margin: 0; font-weight: 600; }

/* dashboard */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; text-decoration: none; display: grid; gap: 2px; }
.tile:hover { border-color: var(--ink); }
.tile-num { font: 700 36px/1 var(--slab); }
.tile-label { color: var(--muted); }
.tile-sub { font-size: 13px; color: var(--gold-text); font-weight: 600; }
.tile-warn .tile-num { color: var(--danger); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.feed li:first-child { border-top: 0; }
.feed p { overflow-wrap: anywhere; }
.feed time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.mini-products { list-style: none; margin: 0; padding: 8px 0; }
.mini-products li { display: flex; align-items: center; gap: 12px; padding: 8px 20px; }
.mini-products img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-sm); background: var(--line-soft); }
.mini-products div { display: grid; flex: 1; min-width: 0; }
.mini-products strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.lvl { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 10px; vertical-align: middle; background: #9aa1aa; }
.lvl-danger { background: var(--danger); }
.lvl-login { background: var(--ok); }
.lvl-contact { background: var(--gold); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line-soft); color: var(--muted); vertical-align: middle; }
.badge-gold { background: var(--gold-soft); color: var(--gold-text); }

/* filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 180px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input { padding-left: 38px; }
.count { font-size: 14px; margin-bottom: -10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: 14px; font-weight: 500; }
.chip[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* products */
.product-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.product { display: grid; grid-template-columns: 72px 1fr auto auto; align-items: center; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.product:first-child { border-top: 0; }
.product-img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-sm); background: var(--line-soft); }
.product-body { display: grid; min-width: 0; }
.product-name { font-weight: 600; }
.product-meta { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-price { font: 700 18px/1 var(--slab); white-space: nowrap; }
.product-actions { display: flex; align-items: center; gap: 2px; }
.product.is-off .product-img, .product.is-off .product-body, .product.is-off .product-price { opacity: .5; }
.switch {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 6px; border: 0; background: none; cursor: pointer;
  font: 500 13px/1 var(--font); color: var(--muted); border-radius: var(--r-sm); margin-right: 4px; min-width: 104px;
}
.switch::before { content: ""; width: 34px; height: 20px; border-radius: 99px; background: #c4c9cf; box-shadow: inset -14px 0 0 2px #c4c9cf, inset -14px 0 0 4px #fff; transition: .15s; }
.switch.is-on { color: var(--ok); }
.switch.is-on::before { background: var(--ok); box-shadow: inset 14px 0 0 2px var(--ok), inset 14px 0 0 4px #fff; }
.switch:hover { background: var(--line-soft); }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f7f8f9; }
.table td { padding: 12px 16px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table .num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table-log td:nth-child(2) { overflow-wrap: anywhere; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* sheet (dialog) */
.sheet {
  position: fixed; inset: 0; z-index: 80; margin: 0; padding: 0; border: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  background: rgba(20,22,26,.45); display: flex; justify-content: flex-end;
}
.sheet-form { background: var(--surface); width: min(520px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.18); animation: sheet-in .22s ease-out; }
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.sheet-head h2 { font: 700 22px/1.2 var(--slab); }
.sheet-body { padding: 20px; overflow-y: auto; flex: 1; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); background: #f7f8f9; }
.upload { display: grid; grid-template-columns: 96px 1fr; gap: 6px 16px; align-items: center; }
.upload img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-sm); background: var(--line-soft); grid-row: span 2; }
.upload .btn { justify-self: start; }
body.has-sheet { overflow: hidden; }

/* content page */
.content-form { display: grid; gap: 20px; }
.savebar {
  position: sticky; bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--ink); color: #c9cdd3; padding: 12px 12px 12px 20px; border-radius: var(--r); box-shadow: 0 10px 30px rgba(20,22,26,.25);
}
.savebar .btn-primary { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.savebar .btn-primary:hover { background: #d9a64b; }
.savebar .muted { color: #aab0b8; }

/* auth */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: 14px; padding: 32px 28px; display: grid; gap: 20px; }
.auth-logo { width: 160px; height: auto; }
.auth-card h1 { font: 700 26px/1.2 var(--slab); }
.auth .toasts { position: static; max-width: none; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .side { transform: translateX(-100%); transition: transform .2s ease-out; width: min(300px, 86vw); box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(20,22,26,.45); }
  body.nav-open { overflow: hidden; }
  .side .side-close { display: inline-grid; }
  .main-wrap { margin-left: 0; }
  .topbar .menu-btn { display: inline-grid; margin-left: -8px; color: var(--text); }
  .topbar { padding: 10px 16px; }
  .topbar h1 { font-size: 21px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { width: 42px; padding: 0; }
  .content { padding: 16px 16px 48px; gap: 16px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile:last-child { grid-column: span 2; }
  .tile-num { font-size: 30px; }

  .product { grid-template-columns: 64px 1fr auto; grid-template-areas: "img body price" "img actions actions"; gap: 4px 12px; padding: 12px; }
  .product-img { grid-area: img; width: 64px; height: 64px; align-self: start; }
  .product-body { grid-area: body; }
  .product-price { grid-area: price; font-size: 16px; }
  .product-meta { white-space: normal; }
  .product-actions { grid-area: actions; justify-content: space-between; margin-left: -6px; }
  .switch { margin-right: auto; }

  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { position: relative; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
  .table tr:first-child { border-top: 0; }
  .table td { padding: 2px 0; border: 0; text-align: left !important; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
  .table td:first-child[data-label]::before { display: none; }
  .table .actions { position: absolute; top: 8px; right: 8px; width: auto; }
  .table-log td[data-label]::before { display: none; }
  .table-log tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
  .table-log td:nth-child(1) { grid-column: 1; font-size: 13px; }
  .table-log td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .table-log td:nth-child(3) { grid-column: 2; grid-row: 1; font-size: 13px; text-align: right !important; }

  .sheet { align-items: flex-end; }
  .sheet-form { width: 100%; height: auto; max-height: 92vh; border-radius: 16px 16px 0 0; animation-name: sheet-up; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
  .sheet-foot .btn { flex: 1; }
  .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}
@media (max-width: 520px) {
  .row-2, .grid-4 { grid-template-columns: 1fr; }
  .row-2 .row-2 { grid-template-columns: 1fr 1fr; }
  .filters select, .filters .btn { flex: 1; }
  .feed li { flex-direction: column; gap: 2px; }
  .savebar .muted { display: none; }
  .savebar .btn { width: 100%; }
  .savebar { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* v2 additions */
.nav-badge { margin-left: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.status-new { background: var(--gold-soft); color: var(--gold-text); }
.status-in_progress { background: var(--info-soft); color: #1f3b5c; }
.status-done { background: var(--ok-soft); color: var(--ok); }
.status-spam { background: var(--line-soft); color: var(--muted); }
.inq-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.inq { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 18px; border-top: 1px solid var(--line-soft); text-decoration: none; }
.inq:first-child { border-top: 0; }
.inq:hover { background: #fafafa; }
.inq.is-new { box-shadow: inset 3px 0 0 var(--gold); }
.inq-who { font-weight: 600; }
.inq-meta { color: var(--muted); font-size: 13px; text-align: right; display: grid; justify-items: end; gap: 4px; }
.inq-msg { color: var(--muted); font-size: 14px; grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.items-table td { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.items-table td:last-child { text-align: right; white-space: nowrap; }
.msg-body { white-space: pre-wrap; background: #f7f8f9; border-radius: var(--r-sm); padding: 14px; font-size: 15px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.badge-demo { background: #efe7fb; color: #5b3a99; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.ok-dot, .bad-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.ok-dot { background: var(--ok); }
.bad-dot { background: var(--danger); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
pre.snippet { margin: 0; background: var(--ink); color: #e6e6e6; padding: 16px; border-radius: var(--r-sm); overflow-x: auto; font-size: 13px; line-height: 1.5; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .row-3 { grid-template-columns: 1fr 1fr; } .inq { grid-template-columns: 1fr; } .inq-meta { text-align: left; justify-items: start; grid-auto-flow: column; justify-content: start; } }
.table-wrap.flat { border: 0; border-radius: 0; }
.inq-list.flat { border: 0; border-radius: 0; }
.tile-hot { border-color: var(--gold); box-shadow: inset 0 3px 0 var(--gold); }
.alert a { font-weight: 600; }
.lvl-system { background: #6b5bd2; }
textarea.mono-area { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.6; }
.counter { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 6px; }
.counter.over { color: var(--danger); }
.serp { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; display: grid; gap: 3px; font-family: Arial, sans-serif; background: #fff; }
.serp-url { color: #202124; font-size: 13px; }
.serp-title { color: #1a0dab; font-size: 19px; line-height: 1.3; }
.serp-desc { color: #4d5156; font-size: 14px; line-height: 1.5; }
.code-box { display: grid; gap: 10px; }
.code-box code { font-size: 16px; letter-spacing: .08em; background: var(--line-soft); padding: 10px 12px; border-radius: var(--r-sm); word-break: break-all; }
