/* Own palette — independent of the user's Telegram theme; light/dark follows Telegram (data-theme). */
:root, :root[data-theme="light"] {
  --bg: #ffffff;
  --text: #0b0b0f;
  --hint: #86868b;
  --link: #7000ff;
  --accent: #7000ff;           /* Uzum purple */
  --accent-text: #ffffff;
  --accent-soft: rgba(112, 0, 255, 0.10);
  --surface: #f2f2f5;
  --section: #ffffff;
  --separator: rgba(0, 0, 0, 0.08);
  --danger: #e5383b;
  --success: #1f9d55;
  --success-bg: rgba(31, 157, 85, 0.12);
  --warn: #a86b00;
  --warn-bg: rgba(255, 184, 0, 0.16);
  --star: #f5a623;
  --radius: 12px;
  --bar: 58px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --text: #ffffff;
  --hint: #8e8e93;
  --link: #a873ff;
  --accent: #7000ff;
  --accent-text: #ffffff;
  --accent-soft: rgba(140, 70, 255, 0.22);
  --surface: #1c1c1e;
  --section: #111113;
  --separator: rgba(255, 255, 255, 0.10);
  --danger: #ff5c5f;
  --success: #4cd27b;
  --success-bg: rgba(76, 210, 123, 0.14);
  --warn: #f5b742;
  --warn-bg: rgba(245, 183, 66, 0.14);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
[hidden] { display: none !important; }
.hint { color: var(--hint); }
.center { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 8px; }
.center h2 { margin: 0; font-size: 20px; font-weight: 600; }

/* --- catalog header --- */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 12px 6px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 10px; padding: 0 10px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 0; font-size: 16px; outline: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--accent-text); }
.chip.off { color: var(--hint); text-decoration: line-through; text-decoration-thickness: 1px; }
.chips.cats { padding-top: 0; padding-bottom: 8px; }
.chip.cat { font-weight: 600; padding: 7px 14px; }
.sub.price { color: var(--text); font-weight: 600; }
.count { padding: 4px 12px 8px; font-size: 13px; color: var(--hint); }

/* --- grid --- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 12px calc(var(--bar) + 24px); }
.card { cursor: pointer; background: var(--section); border: 0.5px solid var(--separator); border-radius: var(--radius); overflow: hidden;
  text-align: left; display: block; width: 100%; }
.thumb { position: relative; aspect-ratio: 3 / 4; background: var(--surface); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .nophoto { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--hint); }
.badges { position: absolute; top: 6px; left: 6px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; backdrop-filter: blur(4px); }
.badge.hires { background: var(--success-bg); color: var(--success); background-color: rgba(255, 255, 255, 0.86); }
.badge.new { color: #8a5a00; background: rgba(255, 236, 179, 0.92); }
.badge.incomplete { color: #555; background: rgba(240, 240, 240, 0.92); }
.star { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: rgba(255, 255, 255, 0.95); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }
.star.on { color: var(--star); }
.meta { padding: 7px 9px 9px; min-width: 0; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 13px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- bars and buttons --- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--bg);
  border-top: 0.5px solid var(--separator); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; height: var(--bar); font-size: 14px; color: var(--hint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tab .ico { font-size: 19px; line-height: 1; }
.tab.on { color: var(--accent); font-weight: 600; }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 8px; background: var(--bg);
  border-top: 0.5px solid var(--separator); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.actionbar.above-tabs { bottom: calc(var(--bar) + env(safe-area-inset-bottom)); border-top: 0; padding-bottom: 10px; }
.btn { flex: 1; min-height: 48px; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-size: 16px; font-weight: 600; padding: 0 14px; }
.btn.secondary { background: var(--surface); color: var(--link); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.wide { width: 100%; }
.iconbtn { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; color: var(--hint); }
.linkbtn { color: var(--link); font-size: 15px; }

/* --- sheets (filters, sort) --- */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 0.5px solid var(--separator); }
.sheet-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.sheet-body { flex: 1; overflow-y: auto; padding: 6px 14px 20px; }
.sheet-foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 0.5px solid var(--separator); }
.group { padding: 12px 0 4px; }
.group-title { font-size: 13px; color: var(--hint); margin-bottom: 8px; }
.wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.range { display: flex; align-items: center; gap: 8px; }
.range input { width: 100%; min-width: 0; }
.toggle { width: 100%; text-align: left; display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 0.5px solid var(--separator); }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--surface); position: relative; transition: background 0.15s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: left 0.15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; }
.option { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 2px; border-bottom: 0.5px solid var(--separator); font-size: 16px; }
.option .check { color: var(--accent); font-weight: 700; }

/* --- form controls --- */
.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 0.5px solid var(--separator);
  background: var(--surface); font-size: 16px; outline: none; }
textarea.input { min-height: 84px; resize: vertical; }
.field { display: block; padding: 8px 0; }
.field > span { display: block; font-size: 13px; color: var(--hint); margin-bottom: 5px; }
.error { background: rgba(229, 57, 53, 0.12); color: var(--danger); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }

/* --- actor page --- */
.page { padding-bottom: calc(var(--bar) + 40px); }
.backrow { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 0; }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--surface); }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 100%; width: 100%; aspect-ratio: 3 / 4; max-height: 62vh; object-fit: cover; scroll-snap-align: center; display: block; }
.dots { display: flex; justify-content: center; gap: 5px; padding: 8px 0 0; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--separator); }
.dot.on { background: var(--accent); }
.section { padding: 0 14px; }
.titlerow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0 6px; }
.titlerow h1 { margin: 0; font-size: 21px; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.titlerow .tools { display: flex; gap: 2px; flex: 0 0 auto; }
.titlerow .tools .on { color: var(--star); }
.hiresrow { display: flex; align-items: center; justify-content: space-between; background: var(--success-bg); color: var(--success);
  border-radius: 10px; padding: 4px 6px 4px 12px; margin: 4px 0 8px; font-weight: 600; }
.hiresrow .ctl { display: flex; align-items: center; gap: 4px; }
.hiresrow .ctl button { width: 36px; height: 36px; border-radius: 8px; font-size: 20px; color: var(--success); }
.hiresrow .num { min-width: 28px; text-align: center; font-size: 17px; }
.rows .row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 0.5px solid var(--separator); }
.rows .row:last-child { border-bottom: 0; }
.rows .label { color: var(--hint); flex: 0 0 auto; }
.rows .value { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.rows .value a, .rows .value .link { color: var(--link); text-decoration: none; }
.tag { color: var(--hint); font-size: 13px; }
.rows.unknown { background: var(--warn-bg); border-radius: 10px; padding: 2px 12px 8px; margin: 6px 0; }
.rows.unknown .row { border-bottom-color: rgba(0, 0, 0, 0.06); }
.status { color: var(--hint); font-style: italic; }
.status.requested { color: var(--warn); font-style: normal; font-weight: 600; }
.requestbox { display: flex; justify-content: center; padding-top: 8px; min-height: 56px; align-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--separator); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.missing { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin: 6px 0; font-size: 14px; }
.notes { white-space: pre-wrap; }

/* --- edit photos --- */
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; }
.strip .ph { flex: 0 0 auto; width: 84px; }
.strip img { width: 84px; height: 112px; object-fit: cover; border-radius: 8px; display: block; background: var(--surface); }
.strip .ctl { display: flex; justify-content: space-between; margin-top: 4px; }
.strip .ctl button { width: 26px; height: 26px; border-radius: 6px; background: var(--surface); font-size: 13px; }
.strip .ctl button:disabled { opacity: 0.35; }

/* --- shortlist --- */
.listhead { padding: 14px 14px 6px; font-size: 20px; font-weight: 700; }
.srows { padding: 0 12px calc(var(--bar) + 90px); }
.srow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 0.5px solid var(--separator); }
.srow img, .srow .noimg { width: 46px; height: 60px; border-radius: 8px; object-fit: cover; background: var(--surface); flex: 0 0 auto; }
.srow .info { flex: 1; min-width: 0; text-align: left; }

/* --- overlays --- */
.fullscreen { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; align-items: center; justify-content: center; }
.fullscreen img { max-width: 100%; max-height: 100%; object-fit: contain; }
.toast { position: fixed; left: 50%; bottom: calc(var(--bar) + 84px); transform: translateX(-50%); z-index: 40; max-width: 88vw;
  background: rgba(20, 20, 20, 0.9); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; text-align: center; }

/* --- icons --- */
.ic { display: block; flex: 0 0 auto; }
.chip .ic, .linkbtn .ic, .btn .ic { display: inline-block; vertical-align: -3px; }
.chip { gap: 5px; }
.search .hint { display: flex; }
.tab .ico { display: flex; }
.thumb .nophoto .ic { width: 44px; height: 44px; }
.star .ic { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)); }
.linkbtn.back { display: inline-flex; align-items: center; gap: 2px; }
.iconbtn { color: var(--text); }
.titlerow .tools .iconbtn.on, .star.on { color: var(--star); }
.hiresrow .ctl button { display: inline-flex; align-items: center; justify-content: center; }
.option { gap: 12px; justify-content: flex-start; }
.option .check { margin-left: auto; color: var(--accent); }

/* --- categories row + ⋯ menu --- */
.toprow { display: flex; align-items: center; gap: 4px; }
.toprow .cats { flex: 1; min-width: 0; }
.menubtn { flex: 0 0 auto; width: 38px; height: 38px; }
.chip.cat.add { padding: 6px 10px; color: var(--accent); background: var(--accent-soft); }
.menu-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, 0.25); }
.menu-pop { position: absolute; top: 52px; right: 10px; min-width: 220px; background: var(--section); border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22); padding: 6px; border: 0.5px solid var(--separator); }
.menu-pop .option { border-bottom: 0; padding: 12px 10px; border-radius: 10px; font-size: 15px; }
.menu-pop .option:active { background: var(--surface); }
.catrow { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 0.5px solid var(--separator); }
.catrow .info { flex: 1; min-width: 0; }
.wrapline { white-space: normal; }
.warnline { color: var(--warn); }
.hint.small { font-size: 13px; padding: 6px 0; text-align: center; }

/* --- photo upload --- */
.addphoto { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; min-height: 40px;
  padding: 0 16px; margin-top: 4px; cursor: pointer; font-size: 15px; }
.strip .ctl button { display: inline-flex; align-items: center; justify-content: center; color: var(--text); }

/* overlays fade in instead of popping */
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.menu-backdrop { animation: fade-in 0.15s ease-out; }
.menu-pop { animation: pop-in 0.16s ease-out; transform-origin: top right; }
.sheet { animation: fade-in 0.15s ease-out; }
