:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #17212b;
  --muted: #5d6b79;
  --line: #dde3e9;
  --brand: #0b5cab;
  --brand-ink: #ffffff;
  --brand-soft: #e8f1fb;
  --ok: #17794a;
  --ok-bg: #e6f5ec;
  --err: #b3261e;
  --err-bg: #fdecea;
  --warn-bg: #fff6dd;
  --promo: #b3261e;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--brand); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 .75rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: #eef1f4; padding: .1em .35em; border-radius: 4px; word-break: break-all; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 96px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .875rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* header */
.top { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding-top: 10px; padding-bottom: 0; }
.brand { color: inherit; font-weight: 700; text-decoration: none; font-size: 1.05rem; margin-right: auto; }
.who { display: flex; align-items: center; gap: 12px; font-size: .875rem; }
.who a { color: inherit; text-decoration: none; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { order: 3; width: 100%; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: inherit; text-decoration: none; padding: 10px 12px; white-space: nowrap; border-bottom: 3px solid transparent; opacity: .85; }
.nav a.on, .nav a:hover { opacity: 1; border-bottom-color: #fff; }
@media (min-width: 760px) {
  .top-row { flex-wrap: nowrap; padding-top: 0; }
  .brand { margin-right: 12px; }
  .nav { order: 0; width: auto; flex: 1; }
  .nav a { padding: 16px 14px 13px; }
}
button.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* forms */
label { display: block; font-weight: 600; font-size: .9rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  font: inherit; color: inherit; background: #fff; border: 1px solid #b9c3cd; border-radius: 8px;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid #7fb2ea; outline-offset: 1px; }
.stack > * + * { margin-top: 14px; }
.btn {
  display: inline-block; padding: 10px 18px; min-height: 44px; font: inherit; font-weight: 600; cursor: pointer;
  color: var(--brand-ink); background: var(--brand); border: 1px solid var(--brand); border-radius: 8px; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: #fff; color: var(--brand); border-color: #b9c3cd; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn.wide { width: 100%; }
.grid-form { display: grid; gap: 14px; }
@media (min-width: 700px) { .grid-form { grid-template-columns: repeat(3, 1fr); } .form-end { align-self: end; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2:first-child, .card h1:first-child { margin-top: 0; }
.card + .card, .card + h2 { margin-top: 16px; }
.narrow { max-width: 460px; }
.center-card { margin: 8vh auto 0; }
.note { background: var(--warn-bg); border: 1px solid #ecd9a0; border-radius: 8px; padding: 10px 14px; }
.note.ok { background: var(--ok-bg); border-color: #b5dcc5; }
.note.error { background: var(--err-bg); border-color: #f1b9b4; color: #7a1a15; }
.secret { font-size: 1.05rem; user-select: all; }

/* search */
.search { display: flex; gap: 8px; margin: 0 0 8px; }
.search input { margin: 0; flex: 1; min-width: 0; }

/* tiles */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 84px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--brand); background: var(--brand-soft); }
.tile strong { line-height: 1.25; }
.tile span { font-size: .8rem; color: var(--muted); }
.crumbs { font-size: .875rem; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.chips a { white-space: nowrap; padding: 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: .875rem; text-decoration: none; }
.docs { padding-left: 1.2rem; }
h2[id] { scroll-margin-top: 110px; }

/* product list: cards on phones, table rows on wide screens */
.ptable { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.prow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 14px; border-top: 1px solid var(--line); }
.prow:first-child, .phead + .prow { border-top: 0; }
.phead { display: none; }
.pinfo { grid-column: 1 / -1; min-width: 0; }
.pinfo p { margin: 4px 0 0; font-size: .875rem; }
.pinfo .desc { color: #33414e; overflow-wrap: anywhere; }
.pinfo .meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 14px; overflow-wrap: anywhere; }
.pinfo .place a { text-decoration: none; font-weight: 600; }
.price { background: #f6f8fa; border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.plabel { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.price strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price strong.promo { color: var(--promo); }
.price s { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.price em { font-style: normal; font-size: .7rem; font-weight: 700; color: var(--promo); text-transform: uppercase; }
@media (min-width: 760px) {
  .prow { grid-template-columns: minmax(0, 1fr) 150px 150px; align-items: start; gap: 16px; }
  .phead { display: grid; background: #f0f3f6; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 9px; padding-bottom: 9px; }
  .phead + .prow { border-top: 1px solid var(--line); }
  .pinfo { grid-column: auto; }
  .price { background: none; padding: 0; align-items: flex-end; text-align: right; }
  .plabel { display: none; }
}

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 190px); min-height: 380px; max-width: 760px; margin: 0 auto; }
.chat-head { display: flex; align-items: baseline; justify-content: space-between; color: var(--brand); }
.chat-head h1 { color: var(--ink); }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: #eef1f4; border-bottom-left-radius: 4px; }
.msg.typing { color: var(--muted); font-style: italic; }
.msg.error { background: var(--err-bg); color: #7a1a15; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.chat-form textarea { margin: 0; flex: 1; resize: none; min-height: 44px; }

/* admin */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 12px; white-space: nowrap; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 600; font-size: .92rem; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.data thead th { border-top: 0; background: #f0f3f6; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
table.data th.num, table.data td.num { text-align: right; }
tr.off td, .item.off { opacity: .55; }
td.actions { white-space: nowrap; }
td.actions form { display: inline-block; margin-right: 4px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #e7ebef; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.error { background: var(--err-bg); color: var(--err); }
.tag.warning, .tag.skipped, .tag.running { background: var(--warn-bg); color: #7a5b00; }
.item .q { white-space: pre-wrap; overflow-wrap: anywhere; }
.item + .item { margin-top: 12px; }

/* WhatsApp floating button */
.wa { position: fixed; right: 16px; bottom: 16px; z-index: 20; width: 56px; height: 56px; border-radius: 50%; background: #1faa53; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .28); }
.wa:hover { filter: brightness(1.07); }

@media print { .top, .wa, .search, .chips { display: none; } body { background: #fff; } }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0; }
.ptable + .ptable, .ptable + h2 { margin-top: 16px; }

.stack-tight > * + * { margin-top: 8px; }
.folder-row { display: flex; gap: 8px; align-items: center; }
.folder-row input { margin: 0; flex: 1; min-width: 0; }
input.short { max-width: 160px; }
.sync-last { margin: 12px 0 0; }
h3.sub { margin: 18px 0 6px; font-size: .9rem; color: var(--muted); }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }

/* FAQ */
.chips a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips a.on .muted { color: inherit; opacity: .8; }
.chips { margin: 10px 0 12px; }
.faq { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.faq details + details { border-top: 1px solid var(--line); }
.faq summary { padding: 13px 14px; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.faq summary:hover { background: var(--brand-soft); }
.faq-a { padding: 0 14px 12px; }
.faq-a .q { white-space: pre-wrap; overflow-wrap: anywhere; }
.faq-more { margin-top: 20px; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 14px; }
.faq-edit textarea, .faq-edit input[name="topic"] { font-weight: 400; }
.faq-filter { flex-wrap: wrap; margin: 16px 0; }
.faq-filter select { margin: 0; width: auto; flex: 0 1 auto; }
.faq-filter input { flex: 1 1 220px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
