/* Дизайн-система как у stend.4mont.ru (светлая тема, Ubuntu) */
:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --raised: #ffffff;
  --line: #d7dee6;
  --line-soft: #e3e8ee;
  --fg: #16202c;
  --fg-dim: #5c6b7c;
  --fg-faint: #93a1b0;
  --accent: #c96c14;
  --accent-dim: rgba(201, 108, 20, .10);
  --accent-ink: #2a1400;
  --info: #1f6fb2;
  --info-dim: rgba(31, 111, 178, .08);
  --good: #1f9d63;
  --bad: #d3453f;
  --radius: 12px;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: Ubuntu, "IBM Plex Sans", system-ui, sans-serif; font-size: 15px;
}
a { color: var(--info); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
.container { max-width: 1080px; margin: 0 auto; padding: 24px; }
.container.wide { max-width: 1280px; }
.small { font-size: 12px; }
.muted { color: var(--fg-dim); }
.accent { color: var(--accent); }
.err { color: var(--bad); }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(22, 32, 44, .05);
}

label { display: block; margin: 10px 0 4px; color: var(--fg-dim); font-size: 13px; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%; background: var(--raised); border: 1px solid var(--line); border-radius: 8px;
  color: var(--fg); padding: 10px 12px; font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--info); box-shadow: 0 0 0 3px var(--info-dim); }
textarea { min-height: 56px; resize: vertical; }

button, .btn {
  background: var(--accent); border: 1px solid var(--accent); border-radius: 8px;
  color: #fff; cursor: pointer; font: inherit; font-weight: 600; padding: 10px 18px;
  transition: filter .15s, transform .05s;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { filter: grayscale(.5); cursor: wait; }
button.secondary, .btn.secondary { background: var(--panel); border-color: var(--line); color: var(--fg); }
button.ghost, .btn.ghost { background: transparent; border-color: var(--line); color: var(--fg-dim); padding: 7px 12px; }
button.danger { background: var(--bad); border-color: var(--bad); }
button.wide, .btn.wide { width: 100%; }
button.small { padding: 5px 10px; font-size: 12px; }
button.icon { padding: 10px 12px; }
button.x { background: transparent; border: 0; color: var(--fg-faint); padding: 0 6px; font-size: 16px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.check { display: flex; gap: 8px; align-items: center; color: var(--fg); margin-top: 12px; }
.check input { width: auto; accent-color: var(--accent); }
.sep { text-align: center; color: var(--fg-faint); margin: 16px 0; position: relative; }
.sep:before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line-soft); }
.sep span { background: var(--panel); padding: 0 10px; position: relative; }

.badge { background: var(--line-soft); border-radius: 999px; color: var(--fg-dim); font-size: 12px; padding: 2px 10px; }
.badge.ok { color: var(--good); }
.badge.err { color: var(--bad); }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.chip.att b { cursor: pointer; color: var(--fg-faint); margin-left: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line-soft); padding: 8px 10px; text-align: left; vertical-align: top; }
th { color: var(--fg-dim); font-size: 12px; text-transform: uppercase; }
pre { background: #f4f6f9; border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px; overflow: auto; }
code { background: #f4f6f9; padding: 1px 6px; border-radius: 6px; }

/* навигация и лендинг */
.nav { border-bottom: 1px solid var(--line); background: #ffffffee; backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.nav-in { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.brand img { height: 30px; border-radius: 6px; }
.hero { padding: 56px 0 24px; }
.hero-in { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: start; }
.hero h1 { font-size: 42px; }
.lead { color: var(--fg-dim); font-size: 17px; max-width: 560px; }
.ticks { list-style: none; padding: 0; margin: 18px 0 0; }
.ticks li { padding: 6px 0 6px 28px; position: relative; }
.ticks li:before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }
.login-card { margin: 0; }
.login-card form button { margin-top: 14px; }
.login-card label { margin-top: 12px; }
.login-card form button { margin-top: 16px; }
.login-card .sep + button { margin-top: 0; }
.sec { margin: 34px 0 14px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card .num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700;
  background: var(--accent-dim); color: var(--accent); margin-bottom: 10px; }
a.eco { color: inherit; display: block; transition: transform .12s, border-color .12s, box-shadow .12s; }
a.eco:hover { transform: translateY(-3px); border-color: var(--info); box-shadow: 0 8px 24px rgba(31,111,178,.12); }
.eco-link { color: var(--info); font-size: 13px; font-weight: 600; }
.foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 18px 0; background: #fff; }
@media (max-width: 900px) { .hero-in, .cards { grid-template-columns: 1fr; } .hero h1 { font-size: 32px; } }

/* плитки продуктов (как dv-tile в stend) */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 190px;
  transition: transform .12s, border-color .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-3px); border-color: var(--info); box-shadow: 0 10px 26px rgba(31,111,178,.12); }
.tile-plate { height: 64px; display: flex; align-items: center; }
.tile-plate img { max-height: 64px; max-width: 100%; object-fit: contain; }
.tile-name { font-weight: 700; font-size: 16px; }
.tile-desc { color: var(--fg-dim); font-size: 13px; line-height: 1.45; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tile-enter { color: var(--info); font-weight: 600; font-size: 14px; }

/* модалки */
.modal-back { display: none; position: fixed; inset: 0; background: rgba(6, 9, 14, .55); z-index: 40; }
.modal-back.open { display: block; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  margin: 6vh auto; max-width: 560px; max-height: 86vh; overflow: auto; padding: 24px; width: 92%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25); }

/* cookie */
.cookie-banner { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
  display: flex; gap: 14px; align-items: center; max-width: 640px; box-shadow: 0 10px 30px rgba(22,32,44,.18); }
.cookie-banner span { color: var(--fg-dim); font-size: 13px; }

/* чат */
.topbar { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; }
.chat-wrap { display: flex; gap: 16px; height: calc(100vh - 110px); }
.chat-side { width: 250px; overflow: auto; flex: none; }
.conv { display: flex; justify-content: space-between; gap: 6px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--fg-dim); }
.conv:hover { background: var(--line-soft); }
.conv.cur { background: var(--info-dim); color: var(--fg); }
.chat-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ctx-bar { display: flex; gap: 10px; align-items: center; padding: 10px 12px; margin-bottom: 10px; }
.ctx-bar select { width: auto; max-width: 320px; }
.chat-log { flex: 1; overflow: auto; padding: 6px 2px; }
.msg { margin: 10px 0; padding: 12px 16px; border-radius: 14px; max-width: 84%; }
.msg.user { background: var(--accent-dim); border: 1px solid rgba(201,108,20,.25); margin-left: auto; }
.msg.ai { background: var(--panel); border: 1px solid var(--line); }
.msg .txt { word-break: break-word; }
.msg .src { margin-top: 10px; font-size: 12px; color: var(--fg-dim); }
.msg .src details summary { cursor: pointer; }
.src-item { margin: 6px 0; padding: 8px 10px; background: #f4f6f9; border: 1px solid var(--line-soft); border-radius: 8px; }
.fb { margin-top: 8px; display: flex; gap: 6px; }
.fb button { background: transparent; border: 1px solid var(--line); color: var(--fg-faint); padding: 2px 8px; font-size: 13px; }
.fb button.on { border-color: var(--good); color: var(--good); }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px; margin-top: 10px; }
.chat-input textarea { flex: 1; border: 0; background: transparent; box-shadow: none; }
.chat-input textarea:focus { border: 0; box-shadow: none; }

/* «ИИ думает»: кубик-анимация как в stend */
.thinking { display: flex; gap: 14px; align-items: flex-start; color: var(--fg-dim); font-size: 13px;
  padding: 10px 4px; animation: fadein .2s; }
.thinking .cube { width: 44px; height: 44px; object-fit: contain; flex: none; }
.think-col { width: 100%; }
.thinking .reason { width: 100%; max-height: 90px; overflow: auto; white-space: pre-wrap; color: var(--fg-dim);
  font-size: 12px; background: #f4f6f9; border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* админка */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { background: var(--panel); border: 1px solid var(--line); color: var(--fg-dim); }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.prod-img { max-height: 56px; max-width: 120px; object-fit: contain; background: #f4f6f9; border: 1px solid var(--line-soft); border-radius: 8px; padding: 4px; }

/* фон-«квадратики» как в stend (сетка 34px) */
body {
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 34px 34px;
}
.nav, .foot, .cookie-banner, .modal { background-image: none; }

/* дашборд продуктов: рейл категорий + секции (как в stend) */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } }
.rail { position: sticky; top: 70px; padding: 16px; }
.rail-kicker { font: 700 11px/1 "Ubuntu Mono", monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 10px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--fg-dim); font-size: 14px; }
.rail-link:hover { background: var(--line-soft); color: var(--fg); }
.rail-link.active { background: var(--accent-dim); color: var(--accent-ink); font-weight: 600; }
.rail-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.rail-link.active .rail-dot { background: var(--accent); }
.rail-count { margin-left: auto; font: 600 11px/1 "Ubuntu Mono", monospace; color: var(--fg-faint); }
.hero-mini { padding: 8px 0 4px; }
.eyebrow { font: 700 11px/1 "Ubuntu Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 8px; }
.hero-mini h1 { font-size: 30px; margin-bottom: 8px; }
.dv-section { padding: 26px 0 6px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { font: 700 13.5px/1 "Ubuntu Mono", monospace; letter-spacing: .1em; text-transform: uppercase; margin: 0; }
.sec-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sec-count { font: 600 12px/1 "Ubuntu Mono", monospace; color: var(--fg-faint); }
.tile .btn { align-self: flex-start; }

/* шапка продукта в чате */
.prod-head { display: flex; gap: 12px; align-items: center; padding: 10px 14px; margin-bottom: 10px; }
.prod-head img { height: 34px; max-width: 90px; object-fit: contain; }
.prod-head .ver { width: auto; max-width: 200px; padding: 6px 8px; font-size: 13px; }
.ghost-link { color: var(--fg-dim); font-size: 13px; }
.ghost-link:hover { color: var(--info); }

/* логотип-волл на главной (только логотипы, без описаний) */
.logo-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.logo-cell { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  height: 92px; display: grid; place-items: center; padding: 12px;
  transition: transform .12s, border-color .12s, box-shadow .12s; }
.logo-cell:hover { transform: translateY(-3px); border-color: var(--info); box-shadow: 0 8px 24px rgba(31,111,178,.12); }
.logo-cell img { max-height: 64px; max-width: 100%; object-fit: contain; }
