/* MOEX Terminal: спокойная тёмная тема. Цвета роста и падения проверены валидатором палитр; кроме цвета, направление всегда дублируется знаком и стрелкой. */
:root {
  --bg: #0e1218; --surface: #141a22; --surface2: #1a222c; --hair: #1f2833; --hair2: #2a3441;
  --text: #e7ecf2; --text2: #98a4b3; --text3: #6f7a89;
  --accent: #6ea8fe; --accent-bg: rgba(110, 168, 254, .12);
  --up: #199e70; --up-text: #3dbb8d; --down: #e66767; --down-text: #f08585;
  --warn: #d9a441; --live: #e5484d;
  --r: 14px; --r-s: 9px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h2, h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--text2); letter-spacing: .02em; }
h3 { margin: 18px 0 8px; }
.muted { color: var(--text2); }
.spacer { flex: 1; }
.r { text-align: right; }
.up { color: var(--up-text); } .down { color: var(--down-text); }
.num { font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--hair2); border-radius: 8px; } ::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- вход ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--surface); border-radius: 20px; padding: 28px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: var(--text2); font-size: 12px; }
.login-card input { background: var(--bg); border: 1px solid var(--hair); border-radius: var(--r-s); padding: 11px 12px; font-size: 16px; }
.login-card input:focus, .stepper input:focus, .chat-form textarea:focus, .search input:focus, .modal input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.err { color: var(--down-text); min-height: 1.2em; font-size: 13px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.brand-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #6ea8fe, #4a7fd8); color: #0b1220; font-weight: 800; font-size: 14px; }

/* ---------- кнопки ---------- */
.btn { border: 0; background: var(--surface2); border-radius: var(--r-s); padding: 9px 16px; font-weight: 600; transition: background .12s, opacity .12s; }
.btn:hover { background: var(--hair2); }
.btn.primary { background: var(--accent); color: #0b1220; }
.btn.primary:hover { background: #8bbaff; }
.btn.primary:disabled, .btn.buy:disabled, .btn.sell:disabled { background: var(--surface2); color: var(--text3); cursor: not-allowed; }
.btn.buy { background: var(--up); color: #fff; }
.btn.buy:hover { background: #1db17f; }
.btn.sell { background: var(--down); color: #1a0b0b; }
.btn.sell:hover { background: #ee7a7a; }
.btn.ghost { background: transparent; color: var(--text2); }
.btn.ghost:hover { background: var(--surface2); color: var(--text); }
.btn.icon { padding: 8px; display: inline-grid; place-items: center; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.wide { width: 100%; padding: 13px; font-size: 15px; border-radius: 11px; }
.btn.danger { background: transparent; box-shadow: inset 0 0 0 1px rgba(230, 103, 103, .5); color: var(--down-text); }
.btn.danger:hover { background: rgba(230, 103, 103, .1); }

/* ---------- шапка ---------- */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 16px 4px; }
.search { position: relative; flex: 1; max-width: 400px; }
.search input { width: 100%; background: var(--surface); border: 1px solid transparent; border-radius: 99px; padding: 8px 14px 8px 36px; }
.search input::placeholder { color: var(--text3); }
.search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
.search-res { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface2); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); max-height: 320px; overflow: auto; }
.search-res li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.search-res li span { color: var(--text2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-res li:hover, .search-res li:focus { background: var(--hair2); }
.search-res li small { color: var(--text3); margin-left: auto; }
.badge { display: inline-flex; align-items: center; gap: 7px; border: 0; background: var(--surface); border-radius: 99px; padding: 6px 13px; font-size: 12px; font-weight: 600; color: var(--text2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.badge:hover { color: var(--text); }
.badge.live { background: var(--live); color: #fff; } .badge.live::before { background: #fff; }
.pf-head { text-align: right; line-height: 1.25; }
.pf-head b { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.pf-head small { display: block; font-size: 12px; color: var(--text2); }
.pf-head small.up { color: var(--up-text); } .pf-head small.down { color: var(--down-text); }
.banner { margin: 8px 16px 0; padding: 9px 14px; background: var(--surface); color: var(--text2); border-radius: var(--r-s); font-size: 13px; border-left: 3px solid var(--warn); }
.banner.live { background: rgba(229, 72, 77, .14); color: #ffc2c4; border-left-color: var(--live); }
.banner.err { background: rgba(229, 72, 77, .14); color: #ffc2c4; border-left-color: var(--live); }

/* ---------- сетка ---------- */
#main { flex: 1; min-height: 0; display: grid; gap: 12px; padding: 12px 16px 16px; grid-template-columns: 250px minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr) 250px;
  grid-template-areas: "watch chart side" "bottom bottom side"; }
#p-watch { grid-area: watch; } #p-chart { grid-area: chart; } #p-side { grid-area: side; } #p-bottom { grid-area: bottom; }
.panel { background: var(--surface); border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.scroll { overflow: auto; min-height: 0; flex: 1; }
.tab-body { padding: 14px 16px; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; }
.tabs button { background: none; border: 0; padding: 7px 12px; color: var(--text2); font-weight: 600; border-radius: 99px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); background: var(--surface2); }
.count { background: var(--accent); color: #0b1220; border-radius: 99px; padding: 0 6px; font-size: 11px; margin-left: 4px; font-weight: 700; }

/* ---------- таблицы ---------- */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 500; font-size: 12px; color: var(--text2); padding: 8px 12px; }
.tbl th.r { text-align: right; }
.tbl td { padding: 9px 12px; border-top: 1px solid var(--hair); white-space: nowrap; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, .025); }
.tbl td.empty { white-space: normal; line-height: 1.5; color: var(--text2); border-top: 0; padding: 18px 12px; }
.watch { margin-top: 2px; }
.watch td { padding: 9px 4px; border-top: 0; }
.watch td:first-child { padding-left: 16px; border-radius: 10px 0 0 10px; }
.watch td:last-child { padding-right: 14px; border-radius: 0 10px 10px 0; }
.watch .chgc { font-size: 13px; width: 1%; }
.watch tbody tr { cursor: pointer; }
.watch tbody tr.sel td { background: var(--accent-bg); }
.watch .t { font-weight: 650; }
.watch .nm { display: block; font-size: 12px; color: var(--text2); max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
.watch .rm { opacity: 0; background: none; border: 0; color: var(--text3); padding: 0 6px; margin-left: 2px; border-radius: 4px; font-size: 14px; line-height: 1; }
.watch .rm:hover { color: var(--text); }
.watch tr:hover .rm { opacity: 1; }

/* ---------- график ---------- */
#p-chart { position: relative; }
.chart-head { flex-wrap: wrap; align-items: flex-end; padding: 16px 18px 4px; gap: 6px 22px; }
.tk-line { display: flex; align-items: baseline; gap: 10px; }
.tk-line b { font-size: 15px; font-weight: 650; }
.tk-price { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.chg { font-size: 14px; margin-left: 10px; font-weight: 600; letter-spacing: 0; }
.tk-meta { font-size: 12px; color: var(--text2); display: flex; gap: 14px; flex-wrap: wrap; padding-bottom: 5px; }
.tk-meta b { color: var(--text); font-weight: 600; }
.seg { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; padding: 5px 10px; color: var(--text2); font-weight: 600; border-radius: 8px; font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface2); color: var(--text); }
.seg.wide { display: flex; margin-bottom: 10px; } .seg.wide button { flex: 1; padding: 9px; }
.seg.wide button.buy.on { background: var(--up); color: #fff; }
.seg.wide button.sell.on { background: var(--down); color: #1a0b0b; }
.seg.small button { padding: 6px; font-size: 12px; }
.legend { padding: 0 18px; font-size: 12px; color: var(--text2); min-height: 20px; font-variant-numeric: tabular-nums; }
.legend b { color: var(--text); font-weight: 600; }
.chart { flex: 1; min-height: 160px; margin: 0 6px; }
.attr { font-size: 10px; opacity: .55; text-align: right; padding: 2px 16px 8px; }
.attr a { color: var(--text2); text-decoration: none; }
.setup { position: absolute; inset: 70px 14px 14px; z-index: 5; display: grid; place-items: center; background: rgba(20, 26, 34, .96); border-radius: 12px; padding: 12px; overflow: auto; }
.setup-card { max-width: 560px; display: grid; gap: 12px; }
.setup-card h3 { margin: 0; font-size: 18px; color: var(--text); letter-spacing: 0; font-weight: 650; }
.setup-card pre { margin: 0; padding: 12px; background: var(--bg); border-radius: var(--r-s); font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; user-select: all; }
.setup-card ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- заявка ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.stepper { display: flex; background: var(--bg); border-radius: 11px; overflow: hidden; }
.stepper button { width: 42px; background: none; border: 0; font-size: 18px; color: var(--text2); }
.stepper button:hover { color: var(--text); background: var(--surface2); }
.stepper input { flex: 1; min-width: 0; background: transparent; border: 0; text-align: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 10px 6px; }
.quick { display: flex; gap: 6px; margin-top: 8px; }
.quick button { flex: 1; background: var(--bg); border: 0; border-radius: 8px; padding: 5px; font-size: 12px; color: var(--text2); }
.quick button:hover { color: var(--text); background: var(--surface2); }
.sum { display: grid; grid-template-columns: auto auto; gap: 6px 8px; margin: 14px 0; font-size: 13px; }
.sum dt { color: var(--text2); } .sum dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.verdict { list-style: none; margin: 0 0 12px; padding: 0; font-size: 12px; display: grid; gap: 6px; }
.verdict li { padding: 8px 10px; border-radius: 8px; line-height: 1.4; }
.verdict li.e { background: rgba(229, 72, 77, .12); color: #ffb7b9; }
.verdict li.e::before { content: "✕  "; }
.verdict li.w { background: rgba(217, 164, 65, .12); color: #f0d08a; }
.verdict li.w::before { content: "!  "; }
.book td { padding: 3px 12px; font-size: 12px; position: relative; border-top: 0; z-index: 1; }
.book tr { cursor: pointer; }
.book .bar { position: absolute; top: 2px; bottom: 2px; right: 0; opacity: .16; border-radius: 3px 0 0 3px; z-index: -1; }
.book .bid .bar { background: var(--up); } .book .ask .bar { background: var(--down); }
.book .bid td:first-child { color: var(--up-text); } .book .ask td:first-child { color: var(--down-text); }
.book tr.mid td { text-align: center; color: var(--text2); font-size: 12px; padding: 6px; }

/* ---------- портфель ---------- */
.strip { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 6px; padding: 2px 4px; }
.strip div { font-size: 12px; color: var(--text2); } .strip b { display: block; font-size: 16px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 1px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--surface2); color: var(--text2); }
.tag.assistant { color: #c2b2ff; background: rgba(140, 120, 240, .14); }
.tag.fill { color: var(--up-text); } .tag.blocked, .tag.error, .tag.rejected_by_broker, .tag.unknown { color: var(--down-text); }
.empty { color: var(--text2); padding: 14px 4px; font-size: 13px; }
#p-bottom .tab-body { padding: 8px 12px 12px; }
#p-bottom h3 { margin: 12px 4px 4px; }

/* ---------- ассистент ---------- */
.assist { display: flex; flex-direction: column; padding: 0; min-height: 0; flex: 1; }
.chat { flex: 1; overflow: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 14px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent-bg); color: #dce9ff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface2); border-bottom-left-radius: 4px; }
.msg.typing { color: var(--text2); font-style: italic; }
.prop { align-self: stretch; border-radius: 14px; padding: 12px; background: var(--accent-bg); box-shadow: inset 0 0 0 1px rgba(110, 168, 254, .35); display: grid; gap: 8px; }
.prop.live { background: rgba(229, 72, 77, .12); box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .5); }
.prop-title { font-weight: 650; font-size: 12px; color: var(--accent); }
.prop.live .prop-title { color: #ff9ea1; }
.prop-warn { font-size: 12px; color: #f0d08a; }
.prop-btns { display: flex; gap: 8px; } .prop-btns .btn { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; }
.chips button { background: var(--surface2); border: 0; border-radius: 99px; padding: 5px 12px; font-size: 12px; color: var(--text2); }
.chips button:hover { color: var(--text); }
.chat-form { padding: 8px 12px 12px; display: grid; gap: 8px; }
.chat-form textarea { width: 100%; resize: none; background: var(--bg); border: 1px solid transparent; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.chat-actions { display: flex; align-items: center; gap: 8px; }
.btn.mic { display: inline-flex; align-items: center; gap: 6px; padding: 9px 11px; }
.btn.mic.rec { background: var(--live); color: #fff; }
.btn.mic.rec svg { animation: pulse 1s ease-in-out infinite; }
.btn.mic.busy { color: var(--text3); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- модалка, тосты ---------- */
.overlay { position: fixed; inset: 0; background: rgba(5, 8, 12, .7); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { width: min(440px, 100%); max-height: 100%; overflow: auto; background: var(--surface); border-radius: 18px; padding: 24px; display: grid; gap: 14px; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
.modal.live { box-shadow: 0 0 0 1px var(--live), 0 24px 80px rgba(0, 0, 0, .6); }
.modal h3 { margin: 0; font-size: 18px; color: var(--text); letter-spacing: -.01em; font-weight: 650; }
.modal input[type=text], .modal input[type=password], .modal input[type=number], .modal select { width: 100%; background: var(--bg); border: 1px solid var(--hair); border-radius: var(--r-s); padding: 10px 12px; font-size: 15px; }
.modal label { display: grid; gap: 6px; font-size: 12px; color: var(--text2); }
.modal .row { display: flex; gap: 8px; } .modal .row .btn { flex: 1; }
.modal label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 13px; }
.modal hr { border: 0; border-top: 1px solid var(--hair); width: 100%; margin: 2px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--text2); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv .big { font-size: 18px; font-weight: 650; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(380px, calc(100% - 32px)); }
.toast { background: var(--surface2); border-radius: 12px; padding: 11px 14px; font-size: 13px; box-shadow: 0 10px 36px rgba(0, 0, 0, .55); border-left: 3px solid var(--accent); }
.toast.ok { border-left-color: var(--up); } .toast.bad { border-left-color: var(--down); }

/* ---------- мобильная раскладка ---------- */
.mnav { display: none; }
@media (max-width: 960px) {
  .topbar { padding: 10px 12px 2px; gap: 10px; flex-wrap: wrap; }
  .brand-name { display: none; }
  .search { max-width: none; order: 5; flex: 1 1 100%; }
  .pf-head b { white-space: nowrap; }
  #main { display: block; padding: 8px 10px 10px; overflow: hidden; }
  .panel { display: none; height: 100%; }
  #main[data-view=watch] #p-watch, #main[data-view=chart] #p-chart, #main[data-view=ticket] #p-side, #main[data-view=assistant] #p-side, #main[data-view=portfolio] #p-bottom { display: flex; }
  #side-tabs { display: none; }
  #p-chart .chart { min-height: 260px; }
  .mnav { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
  .mnav button { background: none; border: 0; padding: 13px 2px; font-size: 12px; font-weight: 600; color: var(--text2); }
  .mnav button.on { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
  #toasts { bottom: 70px; }
  .tab-body.assist { height: 100%; }
  .banner { margin: 6px 10px 0; }
}
@media (max-width: 640px) {
  .pf-head small { display: none; }
  .badge { padding: 6px 10px; }
  .tk-meta { display: none; }
  .tk-price { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { .btn.mic.rec svg { animation: none; } }
@media (prefers-reduced-motion: no-preference) { .toast { animation: tin .18s ease-out; } @keyframes tin { from { transform: translateY(8px); opacity: 0; } } }

.banner { position: relative; padding-right: 36px; }
.banner-x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text2); font-size: 18px; line-height: 1; padding: 2px 8px; border-radius: 6px; }
.banner-x:hover { color: var(--text); background: var(--surface2); }

/* компактный список: одна строка на бумагу, название — во всплывающей подсказке */
#main { grid-template-columns: 224px minmax(0, 1fr) 340px; }
.watch td { padding: 6px 4px; font-size: 13px; }
.watch td:first-child { padding-left: 14px; }
.watch td:last-child { padding-right: 12px; }
.watch .t { font-size: 13px; }
.watch .chgc { font-size: 12px; }
.panel-head { padding: 12px 14px 4px; }

/* ---------- список: сортировка и группы ---------- */
select.mini { background: var(--bg); border: 0; border-radius: 8px; padding: 4px 4px; font-size: 12px; color: var(--text2); max-width: 96px; cursor: pointer; }
select.mini:hover { color: var(--text); }
.groups { display: flex; gap: 6px; padding: 2px 12px 8px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.groups::-webkit-scrollbar { display: none; }
.groups button { background: var(--bg); border: 0; border-radius: 99px; padding: 3px 10px; font-size: 12px; color: var(--text2); white-space: nowrap; }
.groups button:hover { color: var(--text); }
.groups button.on { background: var(--accent-bg); color: var(--accent); }
.watch td:last-child { position: relative; }
.watch .rowbtns { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: none; gap: 2px; background: var(--surface2); border-radius: 8px; padding: 1px 2px; }
.watch tr:hover .rowbtns, .watch tr:focus-within .rowbtns { display: flex; }
.watch tr:hover .chg-t, .watch tr:focus-within .chg-t { visibility: hidden; }
.watch .rm { opacity: 1; padding: 2px 6px; margin: 0; font-size: 14px; line-height: 1; border-radius: 6px; }
.watch .rm:hover { background: var(--hair2); }
.watch .t { display: inline-block; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.pick { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- нижняя панель: высота, сворачивание ---------- */
#main { grid-template-rows: minmax(150px, 1fr) var(--bot-h, 280px); }
#main[data-bot=min] { grid-template-rows: minmax(150px, 1fr) 48px; }
#main[data-bot=min] #p-bottom .tab-body { display: none; }
#main[data-bot=max] { grid-template-rows: minmax(150px, 1fr) min(64vh, calc(100vh - 300px)); }
#p-bottom { position: relative; }
.resize-h { position: absolute; top: 0; left: 0; right: 0; height: 9px; cursor: row-resize; z-index: 4; touch-action: none; }
.resize-h::after { content: ""; position: absolute; left: 50%; top: 3px; width: 44px; height: 3px; margin-left: -22px; border-radius: 3px; background: var(--hair2); transition: background .12s; }
.resize-h:hover::after, .resize-h:focus-visible::after { background: var(--accent); }
.tabs .tool { padding: 4px 9px; font-size: 14px; border-radius: 8px; }
.tabs .tool:hover { background: var(--surface2); }
#p-bottom .tabs { padding-top: 12px; }

/* ---------- условия (алерт, стоп, тейк) ---------- */
.trg-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; flex-wrap: wrap; }
.trg-head b { font-size: 16px; }
.fl { display: grid; gap: 6px; font-size: 12px; color: var(--text2); margin-top: 12px; }
.lvl { width: 100%; background: var(--bg); border: 1px solid transparent; border-radius: 11px; padding: 10px 12px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lvl:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hint { font-size: 12px; min-height: 1.3em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.small-note { font-size: 12px; line-height: 1.5; margin: 12px 0 0; }
#trg-form .btn.wide { margin-top: 12px; }
#trg-form label.check { display: flex; gap: 8px; margin-top: 12px; font-size: 12px; align-items: flex-start; }
.trg-list { display: grid; gap: 8px; }
.trg { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 12px; background: var(--bg); border-radius: 11px; cursor: pointer; align-items: center; }
.trg:hover { background: var(--surface2); }
.trg.done { opacity: .6; } .trg.idle { box-shadow: inset 2px 0 0 var(--warn); }
.trg-main { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.trg-st { grid-column: 1; font-size: 12px; overflow-wrap: anywhere; }
.trg .btn { grid-column: 2; grid-row: 1 / span 2; }
.kind { margin-left: 6px; font-size: 10px; font-weight: 600; letter-spacing: .02em; color: var(--text3); text-transform: uppercase; }
tr.dim td { opacity: .6; }

/* ---------- аналитика ---------- */
.an-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 2px 4px 10px; }
.an-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 1.5fr); gap: 4px 24px; }
.eq-chart { height: 190px; }
.an-grid h3, #tab-analytics h3 { margin: 10px 4px 6px; }
@media (max-width: 1100px) { .an-grid { grid-template-columns: 1fr; } }

/* ---------- безопасность и подсказки ---------- */
.modal.wide { width: min(560px, 100%); }
.sec { display: grid; gap: 10px; }
.ok { color: var(--up-text); font-size: 13px; }
.qr { background: #fff; padding: 8px; border-radius: 10px; justify-self: center; }
.secret { font: 13px/1.5 var(--mono); background: var(--bg); padding: 8px 10px; border-radius: 8px; text-align: center; user-select: all; word-break: break-all; }
.tbl.mini td { padding: 5px 8px; font-size: 12px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.keys dt { white-space: nowrap; } .keys dd { margin: 0; color: var(--text2); }
kbd { font: 12px var(--mono); background: var(--bg); border: 1px solid var(--hair2); border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; color: var(--text); }

/* ---------- чат шире (десктоп) ---------- */
@media (min-width: 961px) {
  #main.chat-wide[data-side=assistant] { grid-template-columns: 224px minmax(0, 1fr) min(640px, 46vw); }
  #main.chat-wide[data-side=assistant] .msg { max-width: 96%; font-size: 14px; line-height: 1.55; }
}

/* ---------- мобильная раскладка: вкладки «Заявка / Условия» ---------- */
@media (max-width: 960px) {
  #side-tabs { display: flex; }
  #main[data-view=assistant] #side-tabs, #side-tabs button[data-tab=assistant] { display: none; }
  .resize-h, #bot-expand, #bot-collapse, #chat-wide { display: none; }
  #main { grid-template-rows: none; }
  .an-head .seg { overflow-x: auto; max-width: 100%; }
}
