/* LED Custom Catalog — admin + public styles */
:root {
  --bg: #0d0d12;
  --surface: #15151d;
  --surface-2: #1d1d27;
  --surface-3: #262632;
  --border: #2b2b38;
  --text: #f3f3f8;
  --muted: #9b9bad;
  --accent: #ff2d95;
  --accent-2: #22d3ee;
  --accent-soft: rgba(255, 45, 149, .14);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px rgba(255, 45, 149, .5), 0 0 22px rgba(255, 45, 149, .35);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
small, .muted { color: var(--muted); }
.ic { flex: none; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* ---------- Admin shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 240px; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px; color: var(--text); font-weight: 700; }
.logo:hover { text-decoration: none; }
.logo-mark {
  font-size: 12px; letter-spacing: 1px; padding: 5px 7px; border-radius: 8px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #8b5cf6); box-shadow: 0 0 16px rgba(255, 45, 149, .5);
}
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 10px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; margin-bottom: 2px;
}
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--text); }
.sidebar nav a.active .ic { color: var(--accent); }
.sidebar .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 12px 6px; }
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }
.me small { display: block; }
.me a { color: var(--muted); }
.main { margin-left: 240px; padding: 28px 32px 60px; max-width: 1400px; }
.tabbar { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; width: 270px; box-shadow: var(--shadow); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  .main { margin-left: 0; padding: 16px 16px calc(96px + var(--safe-b)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: rgba(21, 21, 29, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding: 6px 6px calc(6px + var(--safe-b)); justify-content: space-around; align-items: center;
  }
  .tabbar a, .tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted);
    font-size: 10.5px; background: none; border: 0; padding: 4px 0; position: relative; font-family: inherit;
  }
  .tabbar a.active { color: var(--accent); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .cta {
    flex: none; width: 58px; height: 58px; border-radius: 50%; margin-top: -26px; color: #fff; justify-content: center;
    background: linear-gradient(135deg, var(--accent), #8b5cf6); box-shadow: 0 6px 20px rgba(255, 45, 149, .5);
  }
  .tabbar .dot { position: absolute; top: 0; right: 22%; background: var(--accent); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; }
}

/* ---------- Page header & layout ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 18px 0; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
.stat .sub { font-size: 12.5px; color: var(--muted); }
a.card { color: var(--text); }
a.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat.warn .value { color: var(--warning); } .stat.danger .value { color: var(--danger); } .stat.pink .value { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: 600 14px/1.2 inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #ff4aa5; }
.btn-cyan { background: var(--accent-2); border-color: var(--accent-2); color: #04232a; }
.btn-success { background: var(--success); border-color: var(--success); color: #04230f; }
.btn-danger { background: transparent; border-color: rgba(239, 68, 68, .5); color: #ff8080; }
.btn-danger:hover { background: rgba(239, 68, 68, .12); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { min-height: 56px; padding: 14px 22px; font-size: 16.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 38px; min-height: 38px; }
.btn-wa { background: #25d366; border-color: #25d366; color: #052e16; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px; font: 16px/1.35 inherit; font-family: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none; min-height: 44px;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239b9bad' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: #6c6c7d; }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix { display: flex; align-items: center; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border); border-right: 0; border-radius: 11px 0 0 11px; color: var(--muted); }
.input-group input { border-radius: 0 11px 11px 0; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); position: relative; transition: .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { left: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .thumb { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; background: var(--surface-2); }
.table .title-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.table .title-cell b { display: block; color: var(--text); }
.table a.rowlink { color: var(--text); }

/* ---------- Badges & alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge-published, .badge-paid, .badge-ok { background: rgba(34, 197, 94, .14); color: #4ade80; }
.badge-pending_review, .badge-new, .badge-low { background: rgba(245, 158, 11, .15); color: #fbbf24; }
.badge-draft { background: rgba(155, 155, 173, .15); color: #c4c4d4; }
.badge-sent { background: rgba(34, 211, 238, .13); color: var(--accent-2); }
.badge-archived, .badge-cancelled { background: rgba(239, 68, 68, .12); color: #f87171; }
.badge-out { background: rgba(239, 68, 68, .14); color: #f87171; }
.alert { padding: 12px 14px; border-radius: 11px; margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.alert-success { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .35); color: #86efac; }
.alert-error { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .35); color: #fca5a5; }
.alert-info { background: rgba(34, 211, 238, .08); border-color: rgba(34, 211, 238, .3); color: #a5f3fc; }
.alert-warning { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .35); color: #fcd34d; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 240px; position: relative; }
.toolbar .search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search input { padding-left: 38px; }
.toolbar select { width: auto; min-width: 150px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px; cursor: pointer; white-space: nowrap; user-select: none;
}
.chip:hover { text-decoration: none; border-color: var(--muted); }
.chip.active, .chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: #fff; }
.chip input { display: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a .badge { margin-left: 6px; }
.bulkbar { position: sticky; bottom: 12px; z-index: 20; display: none; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-3); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); margin-top: 14px; }
.bulkbar.show { display: flex; }
@media (max-width: 900px) { .bulkbar { bottom: calc(84px + var(--safe-b)); } }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border); color: var(--muted); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ic { width: 44px; height: 44px; opacity: .5; margin: 0 auto 10px; }

/* ---------- Product cards grid (admin & public) ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; color: var(--text); transition: border-color .2s, transform .2s, box-shadow .2s; }
a.pcard:hover { text-decoration: none; border-color: rgba(255, 45, 149, .6); box-shadow: 0 0 24px rgba(255, 45, 149, .15); transform: translateY(-2px); }
.pcard .media { aspect-ratio: 1; background: #0a0a0e; position: relative; overflow: hidden; }
.pcard .media img { width: 100%; height: 100%; object-fit: cover; }
.pcard .media .tag { position: absolute; top: 8px; left: 8px; }
.pcard .media .vid { position: absolute; bottom: 8px; right: 8px; background: rgba(0, 0, 0, .65); border-radius: 8px; padding: 4px 6px; display: flex; color: #fff; }
.pcard .body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pcard .t { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .sku { font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.pcard .price { font-weight: 700; font-size: 1.08rem; margin-top: auto; padding-top: 6px; color: var(--accent); }

/* ---------- Capture wizard ---------- */
.wizard { max-width: 640px; margin: 0 auto; }
.wiz-top { position: sticky; top: 0; z-index: 25; background: var(--bg); padding: 4px 0 12px; margin: -4px 0 6px; }
.wiz-steps { display: flex; gap: 6px; }
.wiz-steps button { flex: 1; background: none; border: 0; padding: 0; color: var(--muted); font: 600 11.5px/1 inherit; font-family: inherit; text-align: left; cursor: pointer; }
.wiz-steps button::before { content: ""; display: block; height: 4px; border-radius: 99px; background: var(--surface-3); margin-bottom: 7px; transition: background .25s; }
.wiz-steps button.done::before, .wiz-steps button.current::before { background: var(--accent); }
.wiz-steps button.current { color: var(--text); }
.wiz-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.wiz-head .sku-pill { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 4px 10px; border-radius: 99px; }
.step { display: none; animation: fadein .25s ease; }
.step.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step h2 { font-size: 1.45rem; margin-bottom: 4px; }
.step > p.lead { color: var(--muted); margin: 0 0 16px; }
.capture-btns { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-bottom: 16px; }
.capture-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 120px;
  border-radius: 18px; border: 1.5px dashed var(--border); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; text-align: center; padding: 12px;
}
.capture-btn.main { border: 0; background: linear-gradient(135deg, var(--accent), #8b5cf6); box-shadow: 0 8px 26px rgba(255, 45, 149, .35); color: #fff; }
.capture-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.capture-btn small { color: inherit; opacity: .75; font-weight: 500; }
.mgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .mgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mitem { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.mitem img, .mitem video { width: 100%; height: 100%; object-fit: cover; }
.mitem.cover { border: 2px solid var(--accent); }
.mitem .cover-tag { position: absolute; left: 6px; top: 6px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.mitem .tools { position: absolute; right: 4px; top: 4px; display: flex; flex-direction: column; gap: 4px; }
.mitem .tools button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.mitem .progress { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #fff; font-size: 13px; font-weight: 600; }
.mitem .progress .bar { width: 70%; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.mitem .progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.mitem.error .progress { background: rgba(127, 29, 29, .8); }
.mitem.video-item { aspect-ratio: 16 / 10; grid-column: 1 / -1; }
.vgrid { display: grid; gap: 10px; }
.wiz-nav {
  position: sticky; bottom: 0; display: flex; gap: 10px; padding: 14px 0 6px; margin-top: 18px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
@media (max-width: 900px) { .wiz-nav { bottom: calc(70px + var(--safe-b)); } }
.wiz-nav .btn { flex: 1; }
.wiz-nav .btn.back { flex: 0 0 auto; }
.tip { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-top: 14px; }
.tip .ic { color: var(--accent-2); margin-top: 1px; }
.qty { display: flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; width: max-content; background: var(--surface-2); }
.qty button { width: 48px; height: 48px; border: 0; background: transparent; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty button:active { background: var(--surface-3); }
.qty input { width: 70px; text-align: center; border: 0; border-radius: 0; background: transparent; font-weight: 700; font-size: 18px; box-shadow: none !important; }
.qty.sm button { width: 36px; height: 36px; } .qty.sm input { width: 48px; font-size: 15px; min-height: 36px; padding: 4px; }
.summary { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14.5px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; word-break: break-word; }
.done-screen { text-align: center; padding: 30px 0; }
.done-screen .big-check { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 16px; background: rgba(34, 197, 94, .15); color: var(--success); display: flex; align-items: center; justify-content: center; }
.draft-list { display: grid; gap: 8px; }
.draft-list a { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.draft-list a:hover { text-decoration: none; border-color: var(--accent); }
.draft-list img { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; background: var(--surface-2); }

/* ---------- Review ---------- */
.review-item { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; }
@media (max-width: 800px) { .review-item { grid-template-columns: 1fr; } }
.gallery-main { aspect-ratio: 1; background: #0a0a0e; border-radius: 12px; overflow: hidden; }
.gallery-main img, .gallery-main video { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.gallery-thumbs button { flex: none; width: 56px; height: 56px; border-radius: 9px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--surface-2); cursor: pointer; position: relative; }
.gallery-thumbs button.active { border-color: var(--accent); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; background: rgba(0,0,0,.35); }

/* ---------- Media manager (product edit) ---------- */
.media-manager .mgrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

/* ---------- Toast & modal ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow); transition: .25s; z-index: 100; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); }
@media (max-width: 900px) { .toast { bottom: calc(90px + var(--safe-b)); } }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 20px; width: min(520px, calc(100% - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse at top, rgba(255, 45, 149, .18), transparent 60%), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth h1 { text-align: center; margin-bottom: 4px; }
.auth .logo { justify-content: center; padding: 0 0 16px; font-size: 18px; }

/* ---------- Bars (dashboard) ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .85; }
.bars .b:hover { opacity: 1; }
.bars .b[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--border); padding: 4px 8px; border-radius: 7px; font-size: 12px; white-space: nowrap; z-index: 2; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }

/* =================== PUBLIC CATALOG =================== */
body.pub { background: var(--bg); }
.pub-header { position: sticky; top: 0; z-index: 30; background: rgba(13, 13, 18, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.pub-header .in { max-width: 1240px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 14px; }
.pub-header .brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: .04em; font-size: 17px; }
.pub-header .brand img { height: 36px; width: auto; }
.pub-header .brand:hover { text-decoration: none; }
.pub-header .grow { flex: 1; }
.cart-btn { position: relative; }
.cart-btn .n { position: absolute; top: -6px; right: -6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 99px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.pub-wrap { max-width: 1240px; margin: 0 auto; padding: 20px 16px 80px; }
.hero { padding: 34px 0 22px; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.8rem); margin-bottom: 8px; text-shadow: 0 0 24px rgba(255, 45, 149, .45); }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; }
.hero .actions { justify-content: center; margin-top: 16px; }
.pub-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 18px; }
.pub-filters .search { flex: 1 1 260px; position: relative; }
.pub-filters .search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.pub-filters .search input { padding-left: 38px; }
.pub-footer { border-top: 1px solid var(--border); padding: 28px 16px 40px; text-align: center; color: var(--muted); font-size: 14px; }
.pub-footer b { color: var(--text); }

.pdetail { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .pdetail { grid-template-columns: 1fr; gap: 18px; } }
.pdetail .gallery-main { border: 1px solid var(--border); }
.pdetail h1 { font-size: clamp(1.4rem, 4vw, 2rem); }
.pdetail .price { font-size: 1.9rem; font-weight: 800; color: var(--accent); margin: 8px 0 4px; }
.pdetail .meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin: 16px 0; }
.pdetail .meta dt { color: var(--muted); }
.pdetail .meta dd { margin: 0; }
.pdetail .desc { color: #d4d4de; white-space: pre-line; }
.buybox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 18px 0; }

.cart-line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-line img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.cart-line .r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.totals-box { display: grid; gap: 6px; }
.totals-box div { display: flex; justify-content: space-between; }
.totals-box .grand { font-size: 1.25rem; font-weight: 800; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }

/* Invoice paper (public + admin view) */
.paper { background: #fff; color: #1a1a22; border-radius: 12px; padding: 34px; max-width: 860px; margin: 0 auto; box-shadow: var(--shadow); }
.paper a { color: #c2006b; }
.paper .inv-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 3px solid var(--accent); padding-bottom: 14px; margin-bottom: 20px; }
.paper .inv-brand { font-size: 1.6rem; font-weight: 800; letter-spacing: .08em; }
.paper .inv-brand img { max-height: 54px; margin-bottom: 6px; }
.paper .inv-tag { font-size: 12px; color: #6b6b78; letter-spacing: .08em; text-transform: uppercase; }
.paper .inv-title { font-size: 2rem; font-weight: 800; letter-spacing: .15em; color: #c2006b; text-align: right; }
.paper .inv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; font-size: 14px; }
@media (max-width: 600px) { .paper { padding: 20px; } .paper .inv-cols { grid-template-columns: 1fr; } }
.paper .lbl { font-size: 11px; font-weight: 700; color: #c2006b; letter-spacing: .12em; margin-bottom: 6px; }
.paper table { width: 100%; border-collapse: collapse; font-size: 14px; }
.paper th { background: #15151c; color: #fff; font-size: 11.5px; letter-spacing: .06em; padding: 9px 8px; text-align: left; }
.paper td { padding: 9px 8px; border-bottom: 1px solid #e6e6ee; vertical-align: top; }
.paper .r { text-align: right; } .paper .c { text-align: center; }
.paper .totals { margin-left: auto; width: min(320px, 100%); margin-top: 12px; }
.paper .totals td { border: 0; padding: 6px 8px; }
.paper .totals .due td { background: #15151c; color: #fff; font-weight: 800; font-size: 1.1rem; }
.paper .thanks { text-align: center; font-weight: 800; letter-spacing: .2em; color: #c2006b; margin-top: 26px; }
.paper .sku { color: #8a8a96; font-size: 12px; }

/* Invoice editor */
.lines .line { display: grid; grid-template-columns: minmax(0, 1fr) 90px 120px 110px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.lines .line .total { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.lines .head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 700px) {
  .lines .line { grid-template-columns: 1fr 1fr 1fr 40px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; }
  .lines .line .desc { grid-column: 1 / -1; }
  .lines .head { display: none; }
}
.picker-results { max-height: 320px; overflow-y: auto; margin-top: 8px; }
.picker-results button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 8px 4px; color: var(--text); cursor: pointer; font-family: inherit; font-size: 14px; }
.picker-results button:hover { background: var(--surface-2); }
.picker-results img { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; background: var(--surface-2); }

.hide { display: none !important; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

@media print {
  body { background: #fff; }
  .sidebar, .tabbar, .pub-header, .pub-footer, .no-print, .toast { display: none !important; }
  .main, .pub-wrap { margin: 0; padding: 0; }
  .paper { box-shadow: none; padding: 0; }
}
