/* ---------- шрифты (локально, OFL) ---------- */
@font-face { font-family: "Unbounded"; font-weight: 700; font-display: swap; src: url(../fonts/unbounded-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-weight: 700; font-display: swap; src: url(../fonts/unbounded-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-weight: 900; font-display: swap; src: url(../fonts/unbounded-cyrillic-900-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-weight: 900; font-display: swap; src: url(../fonts/unbounded-latin-900-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url(../fonts/manrope-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url(../fonts/manrope-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url(../fonts/manrope-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url(../fonts/manrope-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url(../fonts/manrope-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url(../fonts/manrope-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(../fonts/jetbrains-mono-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(../fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- токены бренда ---------- */
:root {
  --bg: #0E0E10;
  --panel: #17171A;
  --raised: #222226;
  --line: #2A2A2F;
  --ink: #F2F2F0;
  --muted: #A3A3AC;
  --dim: #8A8A93;
  --accent: #FF7A2E;
  --display: "Unbounded", system-ui, sans-serif;
  --text: "Manrope", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --pad: 20px;
  --tap: 140ms;
  /* отступы Telegram (Bot API 8.0+) и системные — берём больший */
  --safe-top: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
a, button, input, textarea, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
input, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* срезанные углы — фирменная деталь */
.cut-xs { clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); }
.cut-s  { clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.cut-m  { clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); }
.cut-l  { clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px); }

/* ---------- каркас экрана ---------- */
#app { max-width: 520px; margin: 0 auto; padding: var(--safe-top) var(--safe-right) 0 var(--safe-left); }
.screen { min-height: calc(var(--tg-viewport-stable-height, 100dvh) - var(--safe-top)); display: flex; flex-direction: column; }
.body { flex: 1; padding: 8px var(--pad) 20px; display: flex; flex-direction: column; gap: 16px; }
.foot { position: sticky; bottom: 0; padding: 12px var(--pad) calc(16px + var(--safe-bottom)); background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.foot.panel { background: var(--panel); flex-direction: row; align-items: center; gap: 14px; }

.top { padding: 16px var(--pad) 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 36px; height: 36px; clip-path: polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px); background: var(--panel); display: grid; place-items: center; font: 900 11px var(--display); letter-spacing: -0.03em; color: var(--accent); flex-shrink: 0; }
.logo.lg { width: 52px; height: 52px; font-size: 15px; clip-path: polygon(12px 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%,0 12px); }
.brand { font: 700 17px var(--display); }
.title { font: 700 18px var(--display); }
.icon-btn { width: 44px; height: 44px; background: var(--panel); display: grid; place-items: center; flex-shrink: 0; }
.pill { min-height: 44px; padding: 0 12px; background: var(--panel); display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; }

/* ---------- типографика ---------- */
h1 { margin: 0; font: 700 clamp(21px, 6.6vw, 26px)/1.22 var(--display); overflow-wrap: break-word; }
h1.lg { font-size: clamp(23px, 7.6vw, 30px); }
.mark { color: var(--accent); }
.lead { color: var(--muted); font-size: 15px; margin: 0; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.acc { color: var(--accent); }
.label { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.price { font: 700 14px var(--display); white-space: nowrap; }
.price.xl { font: 900 22px var(--display); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack.tight { gap: 3px; }

/* ---------- карточки ---------- */
.card { background: var(--panel); padding: 16px; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--panel); width: 100%; text-align: left; }
.row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row .name { font-size: 15px; font-weight: 700; line-height: 1.25; }
.row .sub { font-size: 12px; color: var(--muted); }
.row.featured { box-shadow: inset 3px 0 0 var(--accent); }
.sq { width: 48px; height: 48px; flex-shrink: 0; background: var(--raised); display: grid; place-items: center; }
.sq.sm { width: 44px; height: 44px; }
.sq.acc-bg { background: var(--accent); color: var(--bg); }
.sq svg { width: 24px; height: 24px; }
.info { display: flex; gap: 12px; align-items: center; padding: 14px 16px; background: var(--panel); }
.info .mono { color: var(--accent); flex-shrink: 0; }
.info span:last-child { font-size: 13px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv span:first-child { color: var(--muted); }
.hr { height: 1px; background: var(--line); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { padding: 12px; background: var(--panel); font-size: 13px; font-weight: 700; }
.tile div { font-weight: 400; color: var(--muted); margin-top: 2px; }
.tile-btn { min-height: 44px; background: var(--raised); display: grid; place-items: center; font-size: 13px; font-weight: 700; }

/* цепочка сценария */
.chain { padding: 22px 20px; background: var(--panel); }
.chain .step { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 700; }
.chain .dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--ink); flex-shrink: 0; }
.chain .dot.end { width: 20px; height: 20px; border: 0; background: var(--accent); }
.chain .link { width: 3px; height: 18px; background: #3A3A41; margin-left: 8px; }
.chain .link.hot { background: var(--accent); }
.chain .step.end { color: var(--accent); }

/* ---------- чипы, переключатели ---------- */
.chips { display: flex; gap: 6px; padding: 0 var(--pad) 14px; overflow-x: auto; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; padding: 0; overflow: visible; }
.chip { flex-shrink: 0; min-height: 40px; padding: 0 14px; background: var(--panel); font-size: 13px; font-weight: 700; }
.chip.on { background: var(--ink); color: var(--bg); }
.chip.on-acc { background: var(--accent); color: var(--bg); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px; background: var(--panel); text-align: left; }
.toggle .l { display: flex; align-items: center; gap: 12px; }
.box { width: 22px; height: 22px; flex-shrink: 0; background: #2A2A2F; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--bg); }
.box.on { background: var(--accent); }
.consent { display: flex; gap: 12px; align-items: flex-start; width: 100%; min-height: 44px; padding: 8px 0; text-align: left; font-size: 13px; line-height: 1.45; color: var(--muted); }
.consent u { color: var(--ink); font-weight: 700; }

/* ---------- поля ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field .label-b { font-size: 14px; font-weight: 700; }
.input, .textarea { min-height: 52px; padding: 0 16px; border: 0; background: var(--panel); color: var(--ink); font-size: 15px; outline: none; width: 100%; }
.textarea { padding: 14px 16px; min-height: 120px; resize: none; line-height: 1.45; font-size: 14px; }
.input::placeholder, .textarea::placeholder { color: var(--dim); }

/* ---------- кнопки ---------- */
.btn { min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; font-size: 16px; font-weight: 700; background: var(--ink); color: var(--bg); }
.btn.accent { background: var(--accent); color: var(--bg); }
.btn.ghost { background: var(--panel); color: var(--ink); font-size: 15px; }
.btn[disabled] { background: #1F1F23; color: var(--dim); cursor: default; }
.btn.grow { flex: 1; }
.textlink { min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); width: 100%; }

/* ---------- отклик на нажатие ---------- */
.btn, .row, .chip, .toggle, .icon-btn, .pill, .tile-btn, .box, .textlink {
  transition: transform var(--tap) ease-out, background-color var(--tap), color var(--tap), opacity var(--tap);
}
.btn:active:not([disabled]), .row:active, .chip:active, .toggle:active, .icon-btn:active, .pill:active, .tile-btn:active { transform: scale(.97); }
.box:active, .textlink:active { opacity: .7; }

/* ---------- каталог «по задаче» ---------- */
.tasks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.task { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 104px; padding: 12px; background: var(--panel); text-align: left; color: var(--ink); transition: transform var(--tap) ease-out, background-color var(--tap), color var(--tap); }
.task .ti { width: 36px; height: 36px; display: grid; place-items: center; background: var(--raised); color: var(--accent); clip-path: polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px); }
.task .tt { font-size: 14px; font-weight: 700; line-height: 1.25; }
.task .tn { margin-top: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.task.on { background: var(--accent); color: var(--bg); }
.task.on .ti { background: var(--bg); color: var(--accent); }
.task.on .tn { color: var(--bg); }
.task.other .ti { background: var(--accent); color: var(--bg); }
.task.other .tn { color: var(--accent); }
.task:active { transform: scale(.97); }
.phead { display: flex; justify-content: space-between; align-items: center; min-height: 32px; margin-top: 10px; scroll-margin-top: 12px; }
.phead button { min-height: 32px; }

/* ---------- бриф «На заказ» ---------- */
.rq-progress { flex: 1; max-width: 180px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.rq-progress .mono { font-size: 11px; white-space: nowrap; }
.rq-progress .bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 100%; }
.rq-progress .bar span { height: 4px; background: var(--raised); transition: background-color var(--tap); }
.rq-progress .bar span.on { background: var(--accent); }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tool { min-height: 52px; padding: 6px 8px; background: var(--panel); font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; transition: transform var(--tap) ease-out, background-color var(--tap), color var(--tap); }
.tool.on { background: var(--accent); color: var(--bg); }
.tool:active { transform: scale(.96); }
.pick { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 64px; padding: 12px 16px; background: var(--panel); text-align: left; transition: transform var(--tap) ease-out, box-shadow var(--tap); }
.pick b { font-size: 15px; }
.pick .sub { font-size: 12px; color: var(--muted); }
.pick .radio { width: 22px; height: 22px; flex-shrink: 0; background: var(--raised); clip-path: polygon(5px 0,100% 0,100% calc(100% - 5px),calc(100% - 5px) 100%,0 100%,0 5px); }
.pick.on { box-shadow: inset 3px 0 0 var(--accent); }
.pick.on .radio { background: var(--accent); }
.pick:active { transform: scale(.98); }

/* ---------- меню профиля ---------- */
.menu { background: var(--panel); display: flex; flex-direction: column; }
.mrow { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 68px; padding: 12px 14px; text-align: left; font-size: 15px; font-weight: 700; transition: background-color var(--tap); }
.mrow + .mrow { box-shadow: inset 0 1px 0 var(--line); }
.mrow .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mrow .sub { font-size: 12px; font-weight: 500; color: var(--muted); }
.mrow:not(.static):active { background: var(--raised); }
.avatar { width: 52px; height: 52px; flex-shrink: 0; background: var(--accent); color: var(--bg); display: grid; place-items: center; font: 900 20px var(--display); }
.st { font-family: var(--mono); font-size: 11px; padding: 2px 6px; background: var(--raised); color: var(--muted); white-space: nowrap; }
.st-ok { color: var(--bg); background: var(--accent); }
.st-wait { color: var(--accent); }
.row[disabled] { opacity: .6; cursor: default; }
.faq { background: var(--panel); }
.faq summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 12px 16px; font-size: 15px; font-weight: 700; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { flex-shrink: 0; transition: transform var(--tap); }
.faq[open] summary svg { transform: rotate(90deg); }
.faq p { margin: 0; padding: 0 16px 16px; color: var(--muted); font-size: 14px; }

/* ---------- нижняя панель ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: none; justify-content: space-around; gap: 4px;
  max-width: 520px; margin: 0 auto; padding: 6px calc(8px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(8px + var(--safe-left));
  background: var(--panel); box-shadow: inset 0 1px 0 var(--line); }
.has-tabs .tabbar { display: flex; }
.tab { flex: 1; min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--dim); transition: color var(--tap); }
.tab .ti { width: 48px; height: 30px; display: grid; place-items: center; transition: background-color var(--tap), transform var(--tap); }
.tab.on { color: var(--ink); }
.tab.on .ti { background: var(--accent); color: var(--bg); }
.tab:active .ti { transform: scale(.92); }
.has-tabs #app { padding-bottom: calc(68px + var(--safe-bottom)); }
.has-tabs .foot { bottom: calc(68px + var(--safe-bottom)); padding-bottom: 12px; }
.has-tabs .toast { bottom: calc(84px + var(--safe-bottom)); }

/* ---------- состояния ---------- */
.empty { padding: 32px 4px; text-align: center; color: var(--muted); }
.ok-badge { width: 56px; height: 56px; background: var(--accent); display: grid; place-items: center; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); max-width: calc(100% - 40px); padding: 12px 16px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 700; z-index: 10; }

/* скелетоны в форме будущих карточек */
.sk { background: var(--panel); clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); animation: sk 1.2s ease-in-out infinite alternate; }
.sk-h { height: 64px; width: 72%; background: var(--raised); }
.sk-row { height: 76px; }
.sk-card { height: 132px; }
.sk-chain { height: 132px; }
.sk-line { height: 18px; width: 90%; }
.sk-tile { height: 62px; }
@keyframes sk { from { opacity: 1; } to { opacity: .55; } }

/* View Transitions: каталог ↔ товар */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; animation-timing-function: ease-out; }

@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
  .btn, .row, .chip, .toggle, .icon-btn, .pill, .tile-btn, .box, .textlink, .tab, .tab .ti, .mrow, .task, .tool, .pick { transition: none; }
  .btn:active:not([disabled]), .row:active, .chip:active, .toggle:active, .icon-btn:active, .pill:active, .tile-btn:active { transform: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
