/* Карточка позиции в концепции ленты (#289). Витрина — классы карточки ленты
   (feed-cards.css: tgc-*), здесь — своё (pc-*) и перекрытие старой .mt-card.
   Спека: compliance/docs/projects/lambix-platform/specs/2026-10-13-positions-cards.md */

/* Сетка: колонка от 380 px; карточки ряда не тянутся до самой высокой — раскрытые
   «Инструменты» растят только свою карточку вниз, кнопки соседей не двигаются */
.mt-cards { grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); align-items: start; }

.mt-card.pc-card {
    padding: 0; border: 1px solid rgba(255,255,255,0.07); border-radius: 12px;
    background: var(--bg-card); box-shadow: none; cursor: default; overflow: hidden;
}
.mt-card.pc-card:hover { transform: none; box-shadow: 0 0 0 1px rgba(255,255,255,0.10); }
.pc-card .tgc-head { gap: 6px; }
.pc-card .tgc-sym b { white-space: nowrap; }
.pc-usdt { color: #6e7681; font-weight: 400; font-size: 12px; }
.pc-dir-spot { background: rgba(88,166,255,0.15); color: #58a6ff; }
.pc-card .tgc-src { max-width: 100%; }
.pc-origin .mt-setup-badge { background: none; padding: 0; border: 0; color: #58a6ff; font-size: inherit; }

/* Статус по риску — та же палитра, что у ленты */
.pc-s-mute { background: rgba(139,148,158,0.10); color: #8b949e; }
.pc-s-bad  { background: rgba(248,81,73,0.16);  color: #f85149; }
.pc-s-warn { background: rgba(var(--brand-gold-rgb), 0.14);  color: var(--brand-gold); }
.pc-s-run  { background: rgba(88,166,255,0.14); color: #58a6ff; }
.pc-s-ok   { background: rgba(63,185,80,0.14);  color: #3fb950; }
.pc-s-work { background: rgba(110,118,129,0.12); color: #9fb0c8; }
.pc-good { color: #3fb950 !important; }
.pc-bad  { color: #f85149 !important; }
.pc-muted { color: #8b949e !important; }

/* Биржи в шапке: позиция — с рамкой, вторая приглушена */
.pc-ex { display: inline-flex; gap: 4px; }
.pc-ex .tgs-ex { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 7px; font-size: 12px; font-weight: 700; text-decoration: none; opacity: .55; }
.pc-ex .tgs-ex.pc-here { opacity: 1; box-shadow: 0 0 0 1px currentColor inset; }
.pc-ex .tgs-ex:hover, .pc-ex .tgs-ex:focus-visible { opacity: 1; }
.pc-menu-origin:empty { display: none; }
.pc-menu-origin .mt-card-origin { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px; }

/* Шкала: метки ликвидации и безубытка; взятый тейк — синий */
.pc-mark { position: absolute; top: -3px; width: 2px; height: 14px; }
.pc-mark-liq { background: #a371f7; }
.pc-mark-bep { background: #3fb950; opacity: .8; }
.tgs-tick.pc-t-taken { background: #58a6ff; }
.pc-stop-sl b { color: #f85149; }
.pc-stop-ok b { color: #3fb950; }
.tgc-tile.pc-stop-over { background: rgba(248,81,73,0.10); border: 1px solid rgba(248,81,73,0.4); }
.pc-stop-over b, .pc-stop-over span { color: #f0918b; }
.tgc-tp.pc-taken { background: rgba(88,166,255,0.12); }
.tgc-tp.pc-taken i { color: #58a6ff; }

/* «С входа»: худшее · мини-шкала · лучшее */
.pc-se { display: flex; align-items: center; gap: 8px; height: 28px; margin-top: 8px; font-size: 12px; color: #8b949e; }
.pc-se:empty { visibility: hidden; }
.pc-se b { font-weight: 500; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.pc-se-bar { position: relative; flex: 1; height: 6px; border-radius: 3px; background: #2d3748; }
.pc-se-fill { position: absolute; top: 0; bottom: 0; background: rgba(var(--brand-gold-rgb), 0.35); border-radius: 3px; }
.pc-se-en { position: absolute; top: -4px; width: 2px; height: 14px; background: #c9d1d9; }
.pc-se-now { position: absolute; top: -7px; width: 0; height: 0; margin-left: -5px;
    border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--brand-gold); }

/* Высота задаётся структурой, а не текстом: в закрытом виде карточки ряда равны,
   кнопки на одной линии без растяжки */
.pc-card .tgc-tile, .pc-card .tgc-kpi { border: 1px solid transparent; }
.pc-card .tgc-tile.tgc-risk-over { border-color: rgba(248,81,73,0.4); }
.pc-card .tgc-tile span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-card .tgc-kpi span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.6em; line-height: 1.3; }
.pc-card .tgc-kpi b { font-size: 20px; }
.pc-card .tgc-tps { height: 52px; min-height: 0; }
.pc-card .tgc-tp-empty { line-height: 52px; height: 52px; }
.pc-tv b { display: block; font-size: 17px; line-height: 1.35; white-space: nowrap; color: #e6edf3;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pc-tv span { display: block; font-size: 12px; color: #6e7681; }
.pc-card .tgc-tile small { white-space: nowrap; }
.pc-card .tgc-tile small .mt-entry-toggle { display: inline-flex; vertical-align: 1px; margin-left: 4px; }

/* Строка над кнопками и подсказка — постоянной высоты */
.pc-line { display: flex; align-items: center; gap: 6px; height: 36px; margin-top: 12px; font-size: 12px; color: #8b949e; overflow: hidden; }
.pc-line > * { flex: none; }
/* Hyperliquid: строка авто-стопа с формой трейлинга. Форма раскрывается вместо содержимого */
.pc-hl-m { display: contents; }
.pc-hl-m > * { flex: none; }
.pc-hl-f { display: none; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.pc-line.pc-hl-open > .pc-hl-m { display: none; }
.pc-line.pc-hl-open > .pc-hl-f { display: flex; }
.pc-hl-f input { height: 32px; box-sizing: border-box; padding: 0 8px; border-radius: 6px; font-size: 12px; background: var(--bg-tile);
    border: 1px solid rgba(255,255,255,0.1); color: #e6edf3; }
.pc-hl-pct { width: 52px; flex: none; }
.pc-hl-act { flex: 1; min-width: 0; }
.pc-hl-f > * { flex: none; }
.pc-hl-f > [data-pc-hl-close] { min-width: 32px; }
.pc-tg:disabled:not([data-pc-auto]) { padding: 0 8px; }
.pc-hl-f > .pc-hl-act { flex: 1; }
.pc-tg.pc-hl-chip, .pc-tg.pc-hl-on, .pc-tg[data-pc-hl-start], .pc-tg[data-pc-trail-off] { padding: 0 10px; }
.pc-tg.pc-hl-on { border-color: rgba(63,185,80,0.5); color: #3fb950; cursor: default; }
.pc-chip { height: 32px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 6px; font-size: 12px;
    background: var(--bg-tile); border: 1px solid rgba(255,255,255,0.1); color: #e6edf3; cursor: pointer; }
.pc-chip.on { border-color: var(--brand-gold); color: var(--brand-gold); }
/* ширина не зависит от «✓»/«—»: значки разной ширины сдвигали соседнюю кнопку */
.pc-tg { height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 12px;
    background: var(--bg-tile); border: 1px solid rgba(255,255,255,0.1); color: #c9d1d9; cursor: pointer; }
.pc-tg[data-pc-auto="bep"] { width: 68px; }
.pc-tg[data-pc-auto="trailing"] { width: 96px; }
.pc-tg[aria-pressed="true"] { border-color: rgba(63,185,80,0.5); color: #3fb950; }
.pc-tg:disabled { opacity: .45; cursor: not-allowed; }
.pc-hintrow { display: flex; gap: 8px; height: 18px; line-height: 18px; margin-top: 2px; font-size: 12px; color: #8b949e; }
.pc-hint { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-hintrow .mt-sl-auto-key { flex: none; white-space: nowrap; }
.pc-card.pc-broken { padding: 14px; color: #8b949e; font-size: 13px; }

/* Кнопки: сразу за содержимым (не прижаты к низу — иначе прыгали бы) */
.pc-card .tgc-acts { margin-top: 0; padding-top: 8px; }
.pc-danger { background: transparent; border: 1px solid rgba(248,81,73,0.5); color: #f85149; }
.pc-danger:hover { background: rgba(248,81,73,0.08); }
.pc-wide { grid-column: 1 / -1; }
.pc-chip:focus-visible, .pc-tg:focus-visible, .pc-grip:focus-visible, .pc-tools-sum:focus-visible {
    outline: 2px solid rgba(var(--brand-gold-rgb), 0.6); outline-offset: 2px; }

/* Инструменты: чипы → одна прежняя секция внутри карточки */
.pc-tools { margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.06); padding-top: 6px; }
.pc-tools-sum { width: 100%; min-height: 36px; display: flex; align-items: center; gap: 6px; background: none; border: 0;
    color: #8b949e; font-size: 13px; cursor: pointer; padding: 0; text-align: left; }
.pc-chev { margin-left: auto; transition: transform .15s; }
.pc-tools.open .pc-chev { transform: rotate(180deg); }
.pc-chips { display: none; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.pc-tools.open .pc-chips { display: flex; }
.pc-tool { display: none; margin-top: 6px; }
.pc-tools.open .pc-tool.on { display: block; }
/* Секция открыта чипом — её собственное «свернуть» не действует */
.pc-tool .mt-sec-body--collapsed { display: block !important; }
.pc-tool .mt-sec-chevron { display: none; }

/* Ручка порядка */
.pc-grip { width: 22px; height: 32px; margin-left: -6px; display: inline-flex; align-items: center; justify-content: center;
    color: #6e7681; cursor: grab; touch-action: none; user-select: none; font-size: 16px; border-radius: 6px; }
.pc-grip:hover { color: #c9d1d9; background: rgba(255,255,255,0.05); }
.pc-grip.off { opacity: .3; cursor: not-allowed; }
.pc-card.pc-dragging { opacity: .55; outline: 2px dashed var(--brand-gold); outline-offset: 2px; }
body.pc-drag-on, body.pc-drag-on * { cursor: grabbing !important; user-select: none; }

/* Компакт: статус, шапка, три числа, кнопки */
.mt-cards.mt-compact .pc-card .tgs-scale,
.mt-cards.mt-compact .pc-card .tgc-levels,
.mt-cards.mt-compact .pc-card .pc-tps-sec,
.mt-cards.mt-compact .pc-card .pc-se,
.mt-cards.mt-compact .pc-card .tgc-risk,
.mt-cards.mt-compact .pc-card .pc-line,
.mt-cards.mt-compact .pc-card .pc-hintrow,
.mt-cards.mt-compact .pc-card .pc-tools { display: none; }

@media (max-width: 480px) {
    .pc-card .tgc-kpi b { font-size: 18px; }
    .pc-card .tgc-risk { grid-template-columns: 1fr 1fr; }
    .pc-card .tgc-risk .tgc-tile:nth-child(3) { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .pc-chev { transition: none; } }

/* Не контейнеры в «Позициях»: WebKit (Safari на iPhone) при вставке контейнера
   (container-type) делает промежуточную вёрстку без его содержимого — страница на миг
   короче, и прокрутку прижимает к временному низу: скачок на тике и при опросе
   (журнал 2026-10-15--003). Однострочные кнопки узкой карточки, которые давал
   @container (max-width: 360px) из feed-cards.css, — медиазапросом: карточка позиции
   на телефоне = ширина экрана − 74px */
#view-positions .tgs-card { container-type: normal; }
@media (max-width: 434px) { #view-positions .tgc-acts { grid-template-columns: 1fr; } }
