:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #667085; --line: #e3e6ec;
  --accent: #2563eb; --accent-text: #fff; --error: #b42318; --error-bg: #fef3f2; --ok: #067647; --ok-bg: #ecfdf3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11141a; --card: #1a1f27; --text: #e6e9ef; --muted: #98a2b3; --line: #2b313c;
    --accent: #4f8bff; --error: #fda29b; --error-bg: #3a1714; --ok: #75e0a7; --ok-bg: #0f2e1f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px;
  background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.top nav { display: flex; align-items: center; gap: 16px; }
.top form { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; color: var(--muted); font-size: .9rem; }
input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .button { font: inherit; display: inline-block; background: var(--accent); color: var(--accent-text); border: 0;
  border-radius: 8px; padding: 9px 16px; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; }
.button:hover { text-decoration: none; filter: brightness(1.08); }

.msg { padding: 10px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.msg.error { color: var(--error); background: var(--error-bg); border-color: transparent; }
.msg.notice { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.help { color: var(--muted); font-size: .88rem; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 18px 0 12px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.telegram-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: #2aabee; color: #fff; }
.telegram-button svg { width: 20px; height: 20px; fill: currentColor; }
.telegram-button:disabled { opacity: .6; cursor: default; }
#telegram-status { margin-top: 10px; text-align: center; }

.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; font-size: 1.05rem; padding: 11px 14px; }
.search select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 0 10px; }
.results { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.results th, .results td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.results th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.results tr:last-child td { border-bottom: 0; }
.results .num { text-align: right; white-space: nowrap; }
.results .thumb { width: 56px; }
.results .thumb img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 6px; }
.results .inactive { opacity: .6; }
.sku { color: var(--muted); font-size: .8rem; }
.tag { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--muted); vertical-align: middle; }
.pages { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 16px; color: var(--muted); }

.product { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin-bottom: 16px; }
.product .photo { width: 220px; height: 220px; object-fit: contain; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.meta { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.price { font-size: 1.8rem; font-weight: 700; margin: 0 0 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
#chart { width: 100%; min-height: 320px; }

@media (max-width: 700px) {
  .product { grid-template-columns: 1fr; }
  .product .photo { width: 100%; height: 240px; }
  .results .thumb, .results th:nth-child(5), .results td:nth-child(5) { display: none; }
}
