/* НОТА — приложение: шапка, левая панель, экраны */

.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); grid-template-rows: 58px minmax(0, 1fr); height: 100vh; }
.app.rail-off { grid-template-columns: 64px minmax(0, 1fr); }

/* шапка */
.head { grid-column: 1 / -1; display: grid; grid-template-columns: inherit; grid-template-columns: subgrid; background: var(--head); position: relative; z-index: 5; }
.head::after { content: ""; position: absolute; left: 264px; right: 0; bottom: 0; height: 1px; background: var(--rule); }
.app.rail-off .head::after { left: 64px; }
.brand { position: relative; display: flex; align-items: center; gap: 11px; padding: 0 20px; border-right: 1px solid var(--rule); min-width: 0; overflow: hidden; }
.brand::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, #d6b13d 0%, #d6b13d 12%, rgba(214,177,61,.5) 50%, rgba(214,177,61,0) 80%); }
.brand .word { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.brand .word b { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 16px; letter-spacing: 4px; }
.brand .word span { font-family: 'IBM Plex Mono', monospace; font-size: 8.5px; letter-spacing: 2.6px; color: var(--ink3); }
.app.rail-off .brand { padding: 0 16px; }
.app.rail-off .brand .word { display: none; }

.head-bar { display: flex; align-items: stretch; gap: 28px; padding: 0 26px; min-width: 0; }
.tabs { display: flex; align-items: stretch; gap: 28px; }
.tab { display: flex; align-items: center; font-size: 14.5px; color: var(--ink3); border-bottom: 1.5px solid transparent; margin-bottom: 0; position: relative; z-index: 1; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.head .sound-settings-toggle { flex-shrink: 0; width: 36px; height: 36px; border: none; background: transparent; }
.sound-settings-toggle:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.me-link { display: flex; align-items: center; gap: 9px; color: var(--ink); font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.me-link:hover { color: var(--gold2); }

/* левая панель */
.rail { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: transparent; }
.rail-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 16px; padding: 18px 4px 12px; border-bottom: 1px solid var(--rule); }
.rail-top .icon-btn { border: none; background: transparent; }
.rail-top .icon-btn:hover { background: var(--card-hover); }
.rail-top .lbl { color: var(--ink3); }
.rail-body { flex: 0 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; margin: 0 16px; padding: 10px 0 14px; display: flex; flex-direction: column; gap: 2px; }
.rail-item { display: flex; flex-shrink: 0; align-items: center; gap: 14px; min-height: 58px; padding: 9px 10px; border-radius: 8px; color: var(--ink); }
.rail-project-icon { width: 22px; height: 22px; flex-shrink: 0; color: var(--ink3); }
.rail-item.on .rail-project-icon { color: var(--gold2); }
.rail-item-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.rail-item-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-state { width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: var(--ink4); }
.rail-state.draft { background: var(--open); }
.rail-state.working { background: var(--close); }
.rail-state.finished { background: var(--done); }
.rail-item:hover { background: var(--card-hover); color: var(--ink); }
.rail-item.on { background: var(--card-hover); }
.rail-item .top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rail-item .name { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #b87333; color: #150c05; font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.rail-item .sub { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11px; color: var(--ink3); }
.slot-bar { display: inline-flex; gap: 3px; }
.slot-bar i { width: 12px; height: 6px; border-radius: 2px; background: var(--rule2); }
.slot-bar i.open { background: transparent; border: 1px dashed var(--open); }
.slot-bar i.review { background: var(--review); }
.slot-bar i.close { background: var(--close); }
.slot-bar i.done { background: var(--done); }
.rail-empty { padding: 10px; font-size: 13px; line-height: 1.55; color: var(--ink3); }
.rail-foot { margin-top: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.rail-foot .btn { justify-content: flex-start; gap: 14px; border: none; background: transparent; padding: 0 10px; height: 38px; color: var(--ink3); }
.rail-foot .btn:hover { background: var(--card-hover); color: var(--ink); }
.rail :is(button, a, input):focus-visible { outline: 1px solid var(--gold); outline-offset: -1px; }
.rail-foot .soon { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--ink4); }
.app.rail-off .rail-body, .app.rail-off .rail-top .lbl, .app.rail-off .rail-foot .soon, .app.rail-off .rail-foot .btn span { display: none; }
.app.rail-off .rail-top { justify-content: center; margin: 0 8px; padding: 16px 0 8px; }
.app.rail-off .rail-foot { padding: 12px 8px; }

/* основная область */
.main { min-width: 0; min-height: 0; overflow: auto; }
.screen { max-width: 1240px; margin: 0 auto; padding: 30px 36px 70px; display: flex; flex-direction: column; gap: 22px; }
.screen-head { display: flex; flex-direction: column; gap: 8px; }
.screen-head h1 { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 30px; letter-spacing: -.3px; }
.screen-head p { max-width: 720px; font-size: 15px; color: var(--ink2); text-wrap: pretty; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 0; color: var(--ink3); cursor: pointer; font-size: 13.5px; }
.back:hover { color: var(--gold2); }
.loading, .empty { padding: 40px 0; text-align: center; color: var(--ink3); font-size: 14px; }

/* поиск */
.search { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 18px; border: 1px solid var(--gold); border-radius: 14px; background: var(--field); }
.search .ico { color: var(--ink3); font-size: 16px; }
.search input { flex: 1 1 auto; min-width: 0; height: 100%; border: none; background: transparent; outline: none; font-size: 16px; color: var(--ink); }
.filters { display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.filter-row > .lbl { width: 70px; flex-shrink: 0; }
.filter-row select.field { width: auto; height: 32px; padding: 0 10px; font-size: 13px; }
.filter-row .picker { flex: 1 1 360px; max-width: 520px; }
.filter-row .picker .field { height: 36px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.found { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink4); }
.catalog-page { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 0; }
.catalog-page:empty { display: none; }
.catalog-page p { color: var(--danger); font-size: 13px; text-align: center; }

/* сетка с разделителями только между ячейками */
.grid-sep { overflow: hidden; }
.grid-sep > .grid { display: grid; margin: -1px 0 0 -1px; }
.grid-sep > .grid > * { border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); min-width: 0; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-1 { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1400px) { .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* карточка проекта */
.pcard { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 28px; padding: 24px 6px 24px 22px; }
.pcard-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pcard-top { display: flex; align-items: center; gap: 10px; }
.pcard h3 { font-size: 20px; letter-spacing: -.2px; }
.pcard .desc { color: var(--ink2); text-wrap: pretty; }
.pcard-side { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.big-status { align-self: flex-start; height: 30px; padding: 0 14px; font-size: 13px; letter-spacing: .8px; }
.priv { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink4); }
.counts { display: flex; flex-direction: column; gap: 8px; }
.counts .bar { display: flex; gap: 4px; }
.counts .bar i { flex: 1; height: 8px; border-radius: 3px; background: var(--rule2); }
.counts .bar i.open { background: transparent; border: 1px dashed var(--open); }
.counts .bar i.review { background: var(--review); }
.counts .bar i.close { background: var(--close); }
.counts .bar i.done { background: var(--done); }
.counts .legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink3); }
.counts .legend b { color: var(--ink); font-weight: 600; }
.owner { font-size: 13px; color: var(--ink3); }
.owner b { font-family: 'IBM Plex Mono', monospace; font-weight: 500; color: var(--ink); }

/* дерево: создатель → роли → слоты */
.tree { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.tree-root { display: inline-flex; align-items: center; gap: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--gold2); }
.tree-root::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.branches { display: flex; flex-direction: column; margin-left: 3px; padding-left: 18px; border-left: 1px solid var(--rule2); }
.branch { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 8px 0 4px; flex-wrap: wrap; }
.branch::before { content: ""; position: absolute; left: -18px; top: 20px; width: 14px; height: 1px; background: var(--rule2); }
.branch-role { min-width: 92px; padding-top: 3px; font-family: 'Unbounded', sans-serif; font-size: 11.5px; font-weight: 500; letter-spacing: .6px; color: var(--ink); }
.leaves { display: flex; flex-wrap: wrap; gap: 6px; }
.leaf { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 7px; font-size: 12px; color: var(--ink2); border: 1px solid var(--rule2); }
.leaf-open { border-style: dashed; border-color: var(--open); }
.leaf-review { border-style: dashed; border-color: var(--review); }

/* карточка слота */
.scell { display: flex; flex-direction: column; gap: 12px; padding: 20px 20px 18px; }
.s-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.s-role { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 15px; letter-spacing: .4px; }
.s-name { font-size: 14.5px; font-weight: 600; }
.s-tz { display: flex; flex-direction: column; gap: 5px; padding: 11px 12px; border-left: 2px solid var(--gold); background: var(--card); border-radius: 0 8px 8px 0; }
.s-tz p { font-size: 13.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; text-wrap: pretty; }
.s-project { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 9px; color: var(--ink); transition: border-color .15s, background .15s; }
.s-project:hover { border-color: var(--gold); background: var(--card-hover); color: var(--ink); }
.s-project b { flex: 1 1 auto; min-width: 0; font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-project .arr { color: var(--gold2); }
.s-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.match { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink3); }
.match.full { color: var(--open); }

/* разработчики */
.dev-layout { display: flex; gap: 22px; align-items: flex-start; }
.dev-layout > .dev-list { flex: 1 1 auto; min-width: 0; }
.dev-row { display: grid; grid-template-columns: 40px minmax(0, 220px) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 13px 14px; cursor: pointer; }
.dev-row:hover { background: var(--card-hover); }
.dev-row.on { background: rgba(214,177,61,.08); }
.dev-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dev-who b { font-family: 'IBM Plex Mono', monospace; font-size: 13.5px; font-weight: 600; }
.dev-who span { font-size: 12.5px; color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-role { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .8px; color: var(--close); }
.dev-stack-trigger { display: inline-flex; padding: 0; border: none; background: transparent; color: inherit; font: inherit; cursor: help; }
.dev-stack-trigger:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.dev-stack-hint { position: fixed; z-index: 2000; width: 320px; padding: 14px 16px; border: 1px solid var(--rule2); border-radius: 12px; background: var(--modal); color: var(--ink2); box-shadow: 0 12px 32px rgba(0,0,0,.25); overflow: auto; }
.dev-stack-hint[hidden] { display: none; }
.dev-stack-hint p { margin: 0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.dev-acts { display: flex; gap: 8px; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rule2); background: transparent; color: var(--ink2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; position: relative; font-size: 14px; }
.round-btn:hover { border-color: var(--gold); color: var(--gold2); }
.round-btn.on { border-color: var(--open); color: var(--open); }
.round-btn.locked { cursor: not-allowed; opacity: .55; }
.round-btn .lock { position: absolute; right: -3px; bottom: -3px; font-size: 10px; }
.side-card {
  flex: 0 0 340px; width: 340px; height: 540px; position: sticky; top: 20px; display: flex; flex-direction: column;
  border: 1px solid var(--rule2); border-left: 3px solid #3f8a66; border-radius: 12px; background: var(--modal); overflow: hidden;
}
.side-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--rule); }
.side-head .t { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-head .t b { font-family: 'IBM Plex Mono', monospace; font-size: 13.5px; }
.side-head .t span { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 1px; color: var(--close); }
.side-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 15px 16px; display: flex; flex-direction: column; gap: 14px; }
.side-foot { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--rule); }
.stack-note { display: flex; flex-direction: column; gap: 4px; }
.stack-note p { padding-left: 2px; font-size: 12.5px; color: var(--ink3); text-wrap: pretty; }

/* страница проекта */
.p-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.p-hero h1 { font-size: 30px; letter-spacing: -.4px; margin-top: 10px; }
.p-hero .desc { margin-top: 10px; max-width: 760px; font-size: 15px; color: var(--ink2); text-wrap: pretty; }
.p-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--ink3); }
.p-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 380px; }
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.stage { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-left: 1px solid var(--rule); }
.stage:first-child { border-left: none; }
.stage b { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.stage span { font-size: 12.5px; color: var(--ink4); }
.stage.past b { color: var(--ink3); }
.stage.now { background: rgba(214,177,61,.08); }
.stage.now b { color: var(--gold2); }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.metric { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-left: 1px solid var(--rule); }
.metric:first-child { border-left: none; }
.metric b { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 22px; }
.metric span { font-size: 12px; color: var(--ink3); }
.section-title { display: flex; align-items: center; gap: 12px; }
.section-title h2 { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 16px; }
.section-title .n { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink4); }
.section-title .line { flex: 1; height: 1px; background: var(--rule); }
.member { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--rule); border-radius: 9px; }
.member .who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.member .who b { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; color: var(--ink); }
.member .who span { font-size: 11.5px; color: var(--ink3); }
.queue { display: flex; flex-direction: column; gap: 8px; }
.queue-item { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px dashed var(--rule2); border-radius: 9px; }
.queue-item .row { display: flex; align-items: center; gap: 10px; }
.queue-item .msg { font-size: 13px; color: var(--ink2); white-space: pre-wrap; }
.queue-item .acts { display: flex; gap: 8px; }

/* Приглашение из умного поиска. */
.invite-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(104, 171, 255, .4);
  border-radius: 50%;
  background: rgba(104, 171, 255, .12);
  color: #82baff;
  font-size: 14px;
  line-height: 1;
  vertical-align: middle;
}
.has-invite { position: relative; }
.has-invite > .invite-mark {
  position: absolute;
  top: 8px;
  right: 8px;
}
.queue-item.has-invite .row { padding-right: 24px; }
.member.has-invite,
.ib-item.has-invite { padding-right: 38px; }
[data-theme="light"] .invite-mark {
  color: #205fba;
  border-color: rgba(32, 95, 186, .4);
  background: rgba(32, 95, 186, .08);
}
.slot-owner-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.workspace { display: flex; align-items: center; gap: 18px; padding: 22px 24px; border: 1px solid var(--rule); border-radius: 14px; }
.workspace .big-lock { font-size: 28px; }
.workspace h3 { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 16px; }
.workspace p { font-size: 13.5px; color: var(--ink3); }

/* профиль */
.prof-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.prof-head .who { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }
.prof-head .who h1 { font-family: 'IBM Plex Mono', monospace; font-size: 24px; font-weight: 600; }
.prof-head .who span { color: var(--ink3); }
.prof-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sound-settings { display: flex; flex-direction: column; gap: 12px; }
.sound-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.about { max-width: 760px; font-size: 15px; line-height: 1.65; color: var(--ink2); white-space: pre-wrap; }
.stack-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.stack-card .top { display: flex; align-items: center; gap: 10px; }
.stack-card .top b { flex: 1 1 auto; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.stack-card .top .tech-ico { width: 20px; height: 20px; }
.stack-card p { font-size: 13.5px; color: var(--ink2); white-space: pre-wrap; text-wrap: pretty; }
.stack-card p.empty-note { color: var(--ink4); }
.pen { display: inline-flex; align-items: center; justify-content: center; }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 13px 4px; color: var(--ink); }
.history-row:hover { background: var(--card-hover); color: var(--ink); }
.history-row .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-row .t b { font-weight: 500; }
.history-row .t span { font-size: 12.5px; color: var(--ink3); }

/* Пользовательский текст не задаёт неограниченную ширину/высоту карточкам. */
:is(.pcard, .scell, .stack-card, .v5-proj, .dev-row, .history-row, .s-tz, .stack-note, .side-body, .sm-row, .prof-head .who, .p-hero > div, .dm-head .t) { min-width: 0; overflow-wrap: anywhere; }
:is(.s-name, .v5-proj-top h3, .pcard h3, .p-hero h1, .prof-head .who h1, .history-row .t b, .sm-row .who .line b, .pc-message-meta a, .pc-message-meta > span, .side-head .t b) { min-width: 0; max-width: 100%; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.prof-head .who > span, .side-body > b { overflow-wrap: anywhere; max-width: 100%; }
.stack-card .top { min-width: 0; }
.stack-card .top b { min-width: 0; overflow-wrap: anywhere; }
.stack-card .top .icon-btn { flex-shrink: 0; }
.history-row .t span { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
.stack-note, .side-body > div { flex-shrink: 0; }

/* окно создания проекта: слоты */
.slot-form { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--rule2); border-radius: 12px; }
.slot-form .head-row { display: flex; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--rule2); border-radius: 10px; overflow: hidden; }
.seg label { display: flex; align-items: center; gap: 8px; padding: 9px 14px; cursor: pointer; font-size: 13.5px; color: var(--ink2); }
.seg label + label { border-left: 1px solid var(--rule2); }
.seg input { accent-color: #b87333; margin: 0; }

/* ===== v5: вкладка «Проекты» один в один ===== */
.v5-wrap { max-width: 1040px; display: flex; flex-direction: column; gap: 28px; }
.v5-h1 { font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: 34px; font-weight: 600; letter-spacing: -.8px; line-height: 1.05; }
.v5-lead { font-size: 15px; line-height: 1.5; color: var(--ink3); }
.v5-search { position: relative; display: flex; align-items: center; }
.v5-search .ring { position: absolute; left: 20px; width: 14px; height: 14px; border: 1.6px solid var(--ink4); border-radius: 50%; pointer-events: none; }
.v5-search .tail { position: absolute; left: 32px; top: 50%; margin-top: 4px; width: 6px; height: 1.6px; background: var(--ink4); transform: rotate(45deg); pointer-events: none; }
.v5-search input { width: 100%; height: 56px; padding: 0 20px 0 50px; border: 1px solid var(--rule); border-radius: 14px; background: rgba(238,241,238,.04); color: var(--ink); font-size: 16px; outline: none; }
.v5-search input:focus { border-color: rgba(214,138,61,.6); background: rgba(238,241,238,.06); }
.v5-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.v5-row > .k { width: 64px; flex-shrink: 0; font-size: 13px; color: var(--ink4); }
.v5-chip { border: 1px solid var(--rule); border-radius: 999px; background: transparent; color: var(--ink2); padding: 7px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.v5-chip.on { border-color: rgba(214,138,61,.55); background: rgba(214,138,61,.14); color: #f0b77a; font-weight: 600; }
[data-theme="light"] .v5-chip.on { color: #8c5322; }
.v5-reset { border: none; background: transparent; color: var(--ink3); padding: 6px 8px; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.v5-reset:hover { color: #e39c52; }
.v5-found { margin-left: auto; font-size: 13px; color: var(--ink4); }
.v5-create { display: inline-flex; align-items: center; gap: 8px; border: none; border-radius: 999px; background: #d68a3d; color: #140b04; padding: 12px 20px; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(214,138,61,.22); }
.v5-create:hover { background: #e39c52; }
.v5-create span { font-size: 17px; line-height: 1; }
.v5-empty { padding: 48px 0; font-size: 15px; line-height: 1.6; color: var(--ink3); max-width: 520px; }
.v5-list { overflow: hidden; border-top: 1px solid var(--rule); }
.v5-list > div { display: flex; flex-direction: column; margin-bottom: -1px; }
.v5-proj { display: flex; flex-direction: column; gap: 22px; padding: 26px 4px 30px; border-bottom: 1px solid var(--rule); }
.v5-proj-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.v5-proj-top .t { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 680px; }
.v5-proj-top h3 { font-family: 'Unbounded', 'Onest', sans-serif; font-size: 18px; font-weight: 500; line-height: 1.3; color: var(--ink); text-wrap: pretty; }
.v5-proj-top p { font-size: 14px; line-height: 1.55; color: var(--ink2); text-wrap: pretty; }
.v5-proj-top .c { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; flex-shrink: 0; }
.v5-bar { display: flex; gap: 4px; }
.v5-bar i { flex: 1 1 0; width: 36px; max-width: 36px; height: 6px; border-radius: 3px; background: rgba(238,241,238,.2); }
.v5-bar i.open { background: #7fc7a3; } .v5-bar i.review { background: #e0c46a; } .v5-bar i.close { background: #d68a3d; }
.v5-cline { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; color: var(--ink3); white-space: nowrap; }
.v5-go-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.v5-go { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-width: 220px; border-radius: 999px; background: #3a2314; color: #f1e2cc; padding: 12px 26px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.v5-go:hover { background: #4a2d19; color: #fff3e3; }
.v5-go span { font-size: 17px; line-height: 1; }

/* древо: тим-лид → роли → слоты */
:root { --nt-box: #10221a; --nt-line: rgba(238,241,238,.22); --nt-role-b: rgba(238,241,238,.3); }
[data-theme="brown"] { --nt-box: #2c1b0f; --nt-line: rgba(246,238,228,.24); --nt-role-b: rgba(246,238,228,.3); }
[data-theme="light"] { --nt-box: #fbf9f5; --nt-line: #c9c0ae; --nt-role-b: #c9c0ae; }
.nt { display: flex; flex-direction: column; }
.nt-head { position: relative; display: flex; flex-direction: column; align-items: center; }
.nt-status { position: absolute; left: 0; top: 8px; display: inline-flex; align-items: center; gap: 8px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 14px; font-weight: 700; letter-spacing: .5px; padding: 7px 14px; border-radius: 999px; border: 1px solid; }
.nt-status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.nt-status.draft { color: #9fd6b9; background: rgba(127,199,163,.14); border-color: rgba(127,199,163,.7); }
.nt-status.working { color: #f0b77a; background: rgba(214,138,61,.14); border-color: rgba(214,138,61,.7); }
.nt-status.finished { color: #a9b8b0; background: rgba(238,241,238,.06); border-color: rgba(238,241,238,.3); }
[data-theme="light"] .nt-status.draft { color: #1f4a37; } [data-theme="light"] .nt-status.working { color: #8c5322; } [data-theme="light"] .nt-status.finished { color: #6b7075; }
.nt-owner { display: flex; align-items: center; gap: 9px; padding: 9px 14px; border: 1px solid rgba(214,177,61,.55); border-radius: 10px; background: var(--nt-box); }
.nt-owner .n { display: flex; flex-direction: column; }
.nt-owner .n b { font-size: 13px; font-weight: 600; color: var(--ink); }
.nt-owner .n span { font-size: 10.5px; color: var(--ink4); }
.nt-v { width: 1px; height: 18px; background: var(--nt-line); }
.nt-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.nt-row { display: flex; flex-wrap: nowrap; align-items: flex-start; min-width: 100%; width: max-content; }
.nt-col { position: relative; flex: 1 0 170px; min-width: 170px; display: flex; flex-direction: column; align-items: center; padding: 0 7px; }
.nt-col.wide { flex: 2 0 380px; min-width: 380px; }
.nt-col .bl, .nt-col .br { position: absolute; top: 0; height: 1px; background: var(--nt-line); }
.nt-col .bl { left: 0; right: 50%; } .nt-col .br { left: 50%; right: 0; }
.nt-col:first-child .bl, .nt-col:last-child .br { background: transparent; }
.nt-role { position: relative; z-index: 1; width: 100%; max-width: 200px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 10px; border: 1px solid var(--nt-role-b); border-radius: 9px; background: var(--nt-box); }
.nt-role b { font-family: 'Unbounded', 'Onest', sans-serif; font-size: 12.5px; font-weight: 500; color: var(--ink); }
.nt-role span { font-size: 10.5px; color: var(--ink4); }
.nt-slots { position: relative; width: 100%; max-width: 200px; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.nt-slots .trunk { position: absolute; left: 50%; top: 0; bottom: 24px; width: 1px; background: var(--nt-line); }
.nt-slots.wide { max-width: 420px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding-top: 28px; }
.nt-slots.wide .trunk { bottom: auto; height: 14px; }
.nt-slots .fork, .nt-slots .legl, .nt-slots .legr { display: none; position: absolute; background: var(--nt-line); }
.nt-slots.wide .fork { display: block; left: calc(25% - 2.5px); right: calc(25% - 2.5px); top: 14px; height: 1px; }
.nt-slots.wide .legl { display: block; left: calc(25% - 2.5px); top: 14px; bottom: 24px; width: 1px; }
.nt-slots.wide .legr { display: block; right: calc(25% - 2.5px); top: 14px; bottom: 24px; width: 1px; }
.nt-slot { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 7px; width: 100%; padding: 9px 10px; border-radius: 9px; border: 1px solid; }
.nt-slot.open { border-style: dashed; border-color: rgba(127,199,163,.65); background: #0c1812; }
.nt-slot.review { border-style: dashed; border-color: rgba(224,196,106,.6); background: #12180f; }
.nt-slot.close { border-color: rgba(238,241,238,.26); background: #10211a; }
.nt-slot.done { border-color: rgba(238,241,238,.14); background: #0d1a14; opacity: .75; }
[data-theme="brown"] .nt-slot { background: var(--nt-box); }
[data-theme="light"] .nt-slot { background: #fbf9f5; }
[data-theme="light"] .nt-slot.open { border-color: rgba(31,74,55,.55); } [data-theme="light"] .nt-slot.review { border-color: rgba(138,109,31,.6); }
[data-theme="light"] .nt-slot.close { border-color: #c9c0ae; } [data-theme="light"] .nt-slot.done { border-color: #ddd6c8; }
.nt-slot .top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; min-width: 0; }
.nt-slot .who { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1 1 60px; }
.nt-slot .who b { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-slot .none { flex: 1 1 60px; min-width: 0; font-size: 12px; color: var(--ink3); }
.nt-slot .st { flex-shrink: 0; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border: 1px solid; border-radius: 999px; }
.nt-slot.open .st { color: #9fd6b9; border-color: rgba(127,199,163,.65); }
.nt-slot.review .st { color: #e6cf85; border-color: rgba(224,196,106,.6); }
.nt-slot.close .st { color: #f0b77a; border-color: rgba(238,241,238,.26); }
.nt-slot.done .st { color: #8fa198; border-color: rgba(238,241,238,.14); }
[data-theme="light"] .nt-slot.open .st { color: #1f4a37; } [data-theme="light"] .nt-slot.review .st { color: #8a6d1f; }
[data-theme="light"] .nt-slot.close .st { color: #8c5322; } [data-theme="light"] .nt-slot.done .st { color: #6b7075; }
.nt-slot .stk { display: flex; flex-wrap: wrap; gap: 4px; }
.nt-slot .stk span { display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 6px; border: 1px solid rgba(238,241,238,.16); border-radius: 5px; color: #dfe7e1; font-size: 11px; white-space: nowrap; }
.nt-slot .stk .tech-ico { width: 11px; height: 11px; }
[data-theme="light"] .nt-slot .stk span { border-color: #c9c0ae; color: #191a1c; }

/* профиль: роль и грейд заметно */
.prof-role { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.prof-role .role { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(214,138,61,.6); background: rgba(214,138,61,.14); color: #f0b77a; font-family: 'Unbounded', 'Onest', sans-serif; font-size: 13px; font-weight: 500; letter-spacing: .4px; }
.prof-role .grade { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(214,177,61,.55); color: var(--gold2); font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; }
[data-theme="light"] .prof-role .role { color: #8c5322; }

.rail-item .rv { flex-shrink: 0; height: 18px; padding: 0 7px; border: 1px dashed var(--review); border-radius: 9px; color: var(--review); font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; }

/* ===== входящие: значок письма в шапке ===== */
.mail-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; color: var(--ink2); border-bottom: 2px solid transparent; }
.mail-btn:hover { color: var(--ink); background: var(--card-hover); }
.mail-btn.on { color: var(--ink); border-bottom-color: var(--gold); border-radius: 9px 9px 0 0; }
.mail-badge { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--btn); color: var(--btn-ink); border: 1px solid var(--gold); font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; line-height: 15px; text-align: center; }

/* ===== входящие: экран ===== */
.inbox-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--rule); }
.ib-tab { display: inline-flex; align-items: center; gap: 8px; padding: 0 0 10px; margin-bottom: -1px; border: none; border-bottom: 2px solid transparent; background: transparent; color: var(--ink3); font-size: 14.5px; cursor: pointer; }
.ib-tab:hover { color: var(--ink); }
.ib-tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }
.ib-tab .n { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--gold2); }
.ib-body { display: flex; flex-direction: column; gap: 26px; padding-top: 6px; }
.ib-group { display: flex; flex-direction: column; }
.ib-group > .lbl { padding-bottom: 10px; }
.ib-item { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 18px; align-items: start; padding: 16px 0; border-top: 1px solid var(--rule); }
.ib-group .ib-item:last-child { border-bottom: 1px solid var(--rule); }
.ib-kind { justify-self: start; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold2); padding-top: 3px; }
.ib-kind-apply { color: var(--open); }
.ib-main { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: 14px; color: var(--ink2); line-height: 1.5; }
.ib-main b { color: var(--ink); font-weight: 600; }
.ib-main a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule2); text-underline-offset: 3px; }
.ib-main a:hover { color: var(--gold2); }
.ib-main .msg { margin: 0; padding-left: 10px; border-left: 2px solid var(--rule2); color: var(--ink3); font-size: 13.5px; }
.ib-who { display: flex; align-items: center; gap: 9px; }
.ib-who a { text-decoration: none; font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.ib-who .faint { font-size: 12px; }
.ib-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ib-item.unread .ib-main span { color: var(--ink); }
.ib-group .ib-item:has(.ib-dot) { grid-template-columns: 14px minmax(0, 1fr) auto; }
.ib-dot { width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: transparent; }
.ib-item.unread .ib-dot { background: var(--gold); }
.ib-time { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink4); white-space: nowrap; }
.ib-soon { padding: 16px 18px; border: 1px dashed var(--rule2); border-radius: 10px; color: var(--ink3); font-size: 13.5px; }
.ib-soon code { font-family: 'IBM Plex Mono', monospace; color: var(--gold2); }

/* ===== умный поиск: кнопка на слоте ===== */
.smart-btn { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 14px; border: 1px solid rgba(214,177,61,.38); border-radius: 9px; background: linear-gradient(90deg, rgba(214,177,61,.10), rgba(214,177,61,0)); color: var(--ink); font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left; }
.smart-btn:hover { border-color: var(--gold); background: linear-gradient(90deg, rgba(214,177,61,.18), rgba(214,177,61,.02)); }
.smart-btn .spark { color: var(--gold); font-size: 14px; }
.smart-btn .arr { margin-left: auto; color: var(--gold2); }

/* ===== умный поиск: окно справа ===== */
.smart-wrap { position: fixed; inset: 0; z-index: 60; }
.smart-dim { position: absolute; inset: 0; background: rgba(2,4,3,.55); opacity: 0; transition: opacity .2s; }
.smart-wrap.in .smart-dim { opacity: 1; }
.smart { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); display: flex; flex-direction: column; background: var(--modal); border-left: 1px solid var(--rule2); box-shadow: -24px 0 60px rgba(0,0,0,.35); transform: translateX(24px); opacity: 0; transition: transform .22s ease, opacity .22s ease; }
.smart-wrap.in .smart { transform: none; opacity: 1; }
.smart::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--gold), rgba(214,177,61,.1)); }
.smart-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--rule); }
.smart-head .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.smart-head .kicker { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }
.smart-head b { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 17px; color: var(--ink); }
.smart-head .sub { font-size: 13px; color: var(--ink3); }
.smart-filters { display: flex; flex-direction: column; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--rule); }
.smart-lbl { display: flex; align-items: baseline; gap: 10px; font-size: 13px; color: var(--ink2); }
.smart-lbl small { font-size: 11.5px; color: var(--ink4); }
.smart-legend { display: flex; gap: 14px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink4); }
.smart-legend span:last-child { margin-left: auto; color: var(--ink3); }
.smart-list { flex: 1; min-height: 0; overflow: auto; }
.sm-row { display: grid; grid-template-columns: 18px 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.sm-row:hover { background: var(--card-hover); }
.sm-row.on { background: var(--card-hover); box-shadow: inset 3px 0 0 var(--gold); }
.sm-row .rank { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink4); }
.pct { --c: var(--ink4); width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; gap: 1px;
  background: radial-gradient(closest-side, var(--modal) 80%, transparent 81%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--rule) 0); }
.pct b { font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 600; color: var(--ink); }
.pct small { font-size: 10px; color: var(--ink3); }
.pct-hi { --c: var(--open); } .pct-mid { --c: var(--review); } .pct-lo { --c: var(--ink4); }
.sm-row .who { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sm-row .line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sm-row .line b { font-family: 'IBM Plex Mono', monospace; font-size: 13.5px; color: var(--ink); }
.sm-row .nm { font-size: 12.5px; color: var(--ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-row .role { font-size: 12px; color: var(--ink3); }
.sm-row .role.ok { color: var(--open); }
.sm-row .techs .tech { height: 22px; font-size: 11.5px; padding: 0 7px; }
.smart-peek { position: absolute; top: 76px; right: 22px; bottom: 22px; width: 340px; display: flex; flex-direction: column; background: var(--modal); border: 1px solid var(--rule2); border-left: 3px solid #3f8a66; border-radius: 12px; box-shadow: -18px 18px 50px rgba(0,0,0,.45); overflow: hidden; z-index: 2; }
.smart-peek .side-body p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink2); line-height: 1.5; }
.peek-pct { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; background: rgba(127,199,163,.08); border: 1px solid rgba(127,199,163,.25); }
.peek-pct b { font-family: 'IBM Plex Mono', monospace; font-size: 22px; color: var(--open); }
.peek-pct span { font-size: 12.5px; color: var(--ink3); }

/* ===== фильтры поиска: роль и стек пилюлями, как в макете v5 ===== */
.pf { display: flex; flex-direction: column; gap: 12px; }
.pf-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pf-lbl { width: 44px; flex-shrink: 0; font-size: 13px; color: var(--ink4); }
.pf-lbl-wide { width: auto; }
.pf-search { position: relative; flex-shrink: 0; }
.pf-input { width: 170px; height: 34px; padding: 0 14px; border: 1px dashed var(--rule2); border-radius: 999px; background: transparent; color: var(--ink); font-size: 13px; outline: none; }
.pf-input::placeholder { color: var(--ink3); }
.pf-input:focus { border-style: solid; border-color: rgba(214,138,61,.6); }
.pf-input:disabled { opacity: .6; cursor: not-allowed; }
.pf-sugg { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: 260px; max-height: 260px; overflow: auto; display: flex; flex-direction: column; padding: 6px; border: 1px solid var(--rule2); border-radius: 12px; background: var(--modal); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.pf-sugg button { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: none; border-radius: 8px; background: transparent; color: var(--ink); font-size: 13.5px; text-align: left; cursor: pointer; }
.pf-sugg button:hover { background: var(--card-hover); }
.pf-sugg button span { flex: 1; }
.pf-sugg small { font-size: 11.5px; color: var(--ink4); }
.pf-none { padding: 10px 12px; font-size: 13px; color: var(--ink4); }
.pf-pills { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pill { flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 16px; border: 1px solid var(--rule2); border-radius: 999px; background: transparent; color: var(--ink2); font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.pill:hover { border-color: var(--ink4); color: var(--ink); }
.pill.on { border-color: rgba(214,138,61,.7); background: rgba(214,138,61,.12); color: var(--ink); }
.pill .x { margin-left: 2px; font-size: 14px; line-height: 1; color: var(--ink3); }
.pill .tech-ico { width: 14px; height: 14px; }
.pf-count { flex-shrink: 0; font-size: 12px; color: var(--ink4); }
.pf-foot { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.pf-reset { border: none; background: transparent; color: var(--ink3); padding: 6px 0; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pf-reset:hover { color: #e39c52; }
.pf-foot .found { margin-left: auto; font-size: 13px; color: var(--ink4); }
.pf-wrap { flex-wrap: wrap; row-gap: 8px; }
.pf .check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink2); cursor: pointer; }
.pf .check input { accent-color: #b87333; }
.smart-lbl .pf-pills { flex-wrap: wrap; gap: 6px; }
.smart-filters .pf-pills .pill { height: 28px; font-size: 12.5px; }

/* ===== левая панель: вкладки и список ЛС ===== */
.rail-tabs { display: flex; align-items: center; gap: 18px; }
.rail-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 0 0 6px; border: none; border-bottom: 2px solid transparent; background: transparent; color: var(--ink3); font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; cursor: pointer; }
.rail-tabs button:hover { color: var(--ink); }
.rail-tabs button.on { color: var(--ink); border-bottom-color: var(--gold); }
.rail-tabs .n { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: #b87333; color: #150c05; font-size: 10px; font-weight: 600; line-height: 17px; text-align: center; letter-spacing: 0; }
.app.rail-off .rail-tabs, .app.rail-off #railChats { display: none; }
.rail-find { flex-shrink: 0; height: 34px; font-size: 12px; margin: 2px 0 10px; border-color: var(--rule); background: transparent; border-radius: 6px; }

.rail-chat { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.rail-chat:hover { background: var(--card-hover); }
.rail-chat.on { background: rgba(214,177,61,.10); }
.rail-chat .mid { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rail-chat .top { display: flex; align-items: baseline; gap: 8px; }
.rail-chat .top b { flex: 1; min-width: 0; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-chat .tm { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--ink4); white-space: nowrap; }
.rail-chat .last { font-size: 12.5px; color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-chat.unread .last { color: var(--ink); }
.rail-chat .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #b87333; color: #150c05; font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; line-height: 18px; text-align: center; }

/* ===== кнопка «Сообщения» у разработчика ===== */
.round-btn.ws { background: #eef1ee; color: #1a1a18; border: 1.5px solid #d9822b; text-decoration: none; }
.round-btn.ws:hover { background: #fff; }

/* ===== окно переписки (общее для ЛС и проекта) ===== */
.chat { --chat-bg: #06100b; display: flex; flex-direction: column; min-height: 0; background: var(--chat-bg); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
[data-theme="light"] .chat { --chat-bg: rgba(0,0,0,.035); }
.ch-list { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 3px; }
.ch-empty { margin: auto; max-width: 280px; text-align: center; font-size: 13.5px; line-height: 1.55; color: var(--ink3); }
.ch-day { display: flex; align-items: center; justify-content: center; gap: 12px; flex: 0 0 auto; align-self: stretch; margin: 18px 0 12px; color: var(--ink3); font-size: 11px; }
.ch-day:first-child { margin-top: 8px; }
.ch-day::before, .ch-day::after { content: ""; flex: 1; min-width: 0; height: 1px; background: var(--rule); }
.ch-day time { flex-shrink: 0; padding: 4px 10px; border-radius: 20px; background: var(--card-hover); }
.ch-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; }
.ch-msg.ch-group-start { margin-top: 10px; }
.ch-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.ch-ava { flex: 0 0 28px; width: 28px; }
.ch-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ch-msg.mine .ch-col { align-items: flex-end; }
.ch-who { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 0 4px; }
.ch-who a { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink2); text-decoration: none; }
.ch-who a:hover { color: var(--gold2); }
.ch-tag { display: inline-flex; align-items: center; height: 19px; padding: 0 8px; border-radius: 10px; background: rgba(127,199,163,.10); border: 1px solid rgba(127,199,163,.22); color: var(--ink4); font-size: 11px; white-space: nowrap; }
.ch-tag b { color: var(--open); font-weight: 600; margin-right: 3px; }
.ch-tag.owner { background: rgba(165,139,214,.14); border-color: rgba(165,139,214,.35); color: #b9a3e6; font-weight: 600; }
.ch-bubble { position: relative; padding: 8px 12px 8px; border-radius: 13px 13px 13px 4px; background: rgba(238,241,238,.07); color: var(--ink); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; text-wrap: pretty; }
[data-theme="light"] .ch-bubble { background: rgba(0,0,0,.06); }
.ch-msg.mine .ch-bubble { border-radius: 13px 13px 4px 13px; background: #3a2314; color: #f6efe6; }
.ch-time { display: inline-block; margin-left: 10px; font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--ink4); vertical-align: -1px; }
.ch-msg.mine .ch-time { color: rgba(246,239,230,.55); }
.ch-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--rule); }
.ch-form textarea { flex: 1; min-height: 38px; max-height: 140px; padding: 9px 12px; border: 1px solid var(--rule2); border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.4; resize: none; outline: none; }
.ch-form textarea:focus { border-color: var(--gold); }
.ch-form .btn { height: 38px; }
.ch-form textarea:disabled { opacity: .55; cursor: not-allowed; }
.ch-status { flex-shrink: 0; padding: 8px 16px; border-top: 1px solid var(--rule); color: var(--ink3); font-size: 11px; line-height: 1.5; }
.ch-older { flex-shrink: 0; align-self: center; padding: 8px 12px; margin: 8px; border: 1px solid var(--rule); border-radius: 8px; background: transparent; color: var(--gold2); font-size: 12px; cursor: pointer; }
.ch-older:disabled { opacity: .5; cursor: wait; }
.ch-locked { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 260px; text-align: center; color: var(--ink3); font-size: 13.5px; line-height: 1.55; }

/* ===== ЛС: экран #/chat/{id} ===== */
.dm-screen { height: 100%; max-width: 920px; padding-bottom: 24px; }
.dm-head { display: flex; align-items: center; gap: 12px; }
.dm-head .back { margin-right: 6px; }
.dm-head .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dm-head .t a { font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; }
.dm-head .t span { font-size: 12.5px; color: var(--ink3); }
.dm-stack { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding-top: 4px; }
.dm-head .dm-stack .tech { height: 23px; padding: 0 7px; font-size: 11px; color: var(--ink2); }
.dm-stack .tech-ico { width: 13px; height: 13px; }
.dm-chat { flex: 1 1 auto; }
.dm-chat .ch-form textarea { min-width: 0; padding: 9px 0 7px; border: none; border-bottom: 1px solid var(--gold); border-radius: 0; transition: border-color .15s; }
.dm-chat .ch-form textarea:focus { border-bottom-color: var(--gold2); }

/* Быстрая переписка из списка разработчиков: список и фильтры остаются на месте. */
/* Одна правая позиция для сводки и переписки; поиск остаётся независимым. */
.screen:has(#dChatPanel) { max-width: none; }
.screen:has(#dChatPanel) > :is(.screen-head, .search, .pf) { width: 100%; max-width: 1168px; align-self: center; }
.screen:has(#dChatPanel) .dev-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; width: 100%; max-width: 1168px; align-self: center; align-items: start; }
#dSide { display: contents; }
.screen:has(#dChatPanel) .dev-layout:has(.dev-dock:not([hidden])) { grid-template-columns: minmax(0, 1fr) 360px; width: auto; max-width: none; align-self: stretch; margin-right: -24px; padding-left: max(0px, calc((100% - 1168px) / 2)); }
.dev-dock { position: sticky; top: 16px; grid-column: 2; grid-row: 1; z-index: 4; width: 360px; height: min(600px, max(240px, calc(100dvh - var(--dev-dock-top, 360px) - 16px))); min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid color-mix(in srgb, var(--ink) 17%, transparent); border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.09), transparent 40%, rgba(127,199,163,.04)), color-mix(in srgb, var(--modal) 76%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(135%); backdrop-filter: blur(24px) saturate(135%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 1px 0 0 rgba(255,255,255,.04), 0 18px 48px rgba(0,0,0,.18); }
.dev-dock .side-head, .dev-dock .dm-quick-tools { background: rgba(255,255,255,.025); }
.dev-dock .side-body { scrollbar-width: none; overscroll-behavior: contain; }
.dm-quick { display: flex; flex-direction: column; min-height: 0; }
@media (min-width: 761px) and (max-width: 1500px) {
  .dev-layout:has(.dev-dock:not([hidden])) .dev-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px 12px; }
  .dev-layout:has(.dev-dock:not([hidden])) .dev-who { grid-column: 2; grid-row: 1; }
  .dev-layout:has(.dev-dock:not([hidden])) .dev-row > .techs { grid-column: 2; grid-row: 2; }
  .dev-layout:has(.dev-dock:not([hidden])) .dev-acts { grid-column: 3; grid-row: 1 / span 2; }
}
.dm-quick-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--rule); }
.dm-quick-tools > span { color: var(--ink3); font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
.dm-quick-tools > div { display: flex; gap: 6px; }
.dm-quick-head { align-items: flex-start; padding: 16px; }
.dm-quick .dm-head .t a { font-size: 13px; overflow-wrap: anywhere; }
.dm-quick .dm-head .t > span { font-size: 11.5px; }
.dm-quick .dm-chat { min-height: 0; border: none; border-top: 1px solid var(--rule); border-radius: 0; background: transparent; }
.dm-quick .ch-list { padding: 12px; scrollbar-width: none; overscroll-behavior: contain; }
.dm-quick .ch-form { padding: 10px 12px; }
.dm-quick .ch-form textarea { max-height: 96px; font-size: 13px; }
.dm-quick .ch-bubble { font-size: 13px; }
.round-btn.ws.on { border-color: var(--open); box-shadow: 0 0 0 2px var(--rule); }
@media (max-width: 760px) {
  .screen:has(#dChatPanel) .dev-layout, .screen:has(#dChatPanel) .dev-layout:has(.dev-dock:not([hidden])) { margin-right: 0; padding-left: 0; grid-template-columns: minmax(0, 1fr); }
  .dev-dock { position: fixed; z-index: 40; inset: 70px 12px 12px; width: auto; height: auto; }
  .dm-screen { padding: 16px 12px; }
  .dm-head { flex-wrap: wrap; }
  .dm-head .back { flex-basis: 100%; }
  .screen:has(#dChatPanel) { padding: 20px 16px; }
  .screen:has(#dChatPanel) .pf-row { flex-wrap: wrap; }
  .screen:has(#dChatPanel) .dev-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px 10px; padding: 12px 4px; }
  .screen:has(#dChatPanel) .dev-who { grid-column: 2; grid-row: 1; }
  .screen:has(#dChatPanel) .dev-row > .techs { grid-column: 2; grid-row: 2; }
  .screen:has(#dChatPanel) .dev-acts { grid-column: 3; grid-row: 1 / span 2; }
}

/* ===== проект: две колонки, чат справа закреплён ===== */
#pv { max-width: 1500px; height: 100%; overflow: hidden; padding-bottom: 24px; }
.p-cols { display: grid; flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; align-items: stretch; transition: grid-template-columns .18s ease; }
#pv.chat-collapsed .p-cols { grid-template-columns: minmax(0, 1fr) 64px; }
.p-left { display: flex; flex-direction: column; gap: 22px; min-width: 0; min-height: 0; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; padding-right: 8px; }
.p-left::-webkit-scrollbar { display: none; }
.p-left > * { flex-shrink: 0; }
.p-left .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.p-chat { height: 100%; min-height: 0; background: var(--modal); border-color: var(--rule2); border-radius: 12px; }
.pc-head { display: flex; flex-shrink: 0; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--rule); }
.pc-title { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.pc-toggle { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 9px; border: 1px solid var(--rule); border-radius: 8px; background: transparent; color: var(--ink3); font-size: 11px; cursor: pointer; white-space: nowrap; }
.pc-toggle:hover { background: var(--card-hover); color: var(--gold2); border-color: var(--rule2); }
.pc-toggle-chat { display: none; }
.chat-collapsed .p-chat { position: fixed; top: 58px; right: 0; bottom: 0; width: 64px; height: auto; border: none; border-radius: 0; background: transparent; }
.chat-collapsed .p-chat .pc-head { padding: 16px 8px 8px; border-bottom: none; justify-content: center; }
.chat-collapsed .pc-title, .chat-collapsed .pc-toggle-text, .chat-collapsed .pc-body { display: none; }
.chat-collapsed .pc-toggle { width: 48px; padding: 0; flex-direction: column; gap: 0; border: none; border-radius: 0; }
.chat-collapsed .pc-toggle:hover { background: transparent; }
.chat-collapsed .pc-toggle-chevron { width: 32px; height: 32px; padding: 7px; transform: rotate(180deg); }
.chat-collapsed .pc-toggle-chat { display: flex; align-items: center; flex-direction: column; gap: 12px; width: 100%; margin-top: 8px; padding: 16px 0 12px; border-top: 1px solid var(--rule); }
.chat-collapsed .pc-toggle-chat span { writing-mode: vertical-rl; font-size: 11px; letter-spacing: .5px; }
.pc-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
.pc-head .n { font-size: 12px; color: var(--ink3); }
.pc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.p-chat .ch-list { padding: 8px 20px 18px; gap: 0; overscroll-behavior: contain; scrollbar-width: none; }
.pc-message { display: flex; flex-shrink: 0; align-items: flex-start; gap: 10px; padding: 16px 0; }
.pc-message-avatar { flex: 0 0 28px; margin-top: 1px; }
.pc-message-content { flex: 1; min-width: 0; }
.pc-message-meta { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 7px; row-gap: 2px; line-height: 1.4; }
.pc-message-meta a { color: var(--ink); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.pc-message-meta a:hover { color: var(--gold2); }
.pc-message-meta time { color: var(--ink3); font-size: 10.5px; white-space: nowrap; }
.pc-message-role { margin-top: 3px; }
.p-chat .ch-tag, .p-chat .ch-tag.owner { height: auto; padding: 0; border: none; border-radius: 0; background: none; color: var(--ink3); font-size: 10.5px; font-weight: 400; white-space: normal; }
.p-chat .ch-tag b { color: var(--ink3); font-weight: 400; }
.pc-message-text { margin-top: 5px; color: var(--ink2); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.p-chat .ch-form { flex-shrink: 0; gap: 10px; align-items: flex-end; padding: 14px 16px; border-top: 1px solid var(--rule); }
.ch-compose-avatar { flex: 0 0 28px; align-self: flex-start; margin-top: 5px; }
.p-chat .ch-form textarea { min-width: 0; min-height: 38px; padding: 9px 0 7px; border: none; border-bottom: 1px solid var(--rule2); border-radius: 0; background: transparent; font-size: 12.5px; }
.p-chat .ch-form textarea:focus { border-color: var(--gold); }
.chat .ch-form .btn { flex: 0 0 38px; width: 38px; height: 38px; padding: 4px; border: none; border-radius: 8px; background: transparent; color: var(--gold2); }
.chat .ch-form .btn:hover:not(:disabled) { background: var(--card-hover); color: var(--gold); }
.nota-send-mark { display: block; flex-shrink: 0; transition: transform .15s ease; }
.chat .ch-form .btn:hover:not(:disabled) .nota-send-mark { transform: translateY(-1px); }
.chat .ch-form .btn:active:not(:disabled) .nota-send-mark { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .nota-send-mark { transition: none; }
  .chat .ch-form .btn:is(:hover, :active) .nota-send-mark { transform: none; }
}
.p-chat :is(a, button):focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.p-chat .ch-locked { padding: 24px; }
@media (max-width: 1200px) {
  #pv { height: auto; overflow: visible; }
  .p-cols { grid-template-columns: minmax(0, 1fr); }
  .p-left { overflow: visible; padding-right: 0; }
  .p-chat { height: 560px; }
  #pv.chat-collapsed .p-cols { grid-template-columns: minmax(0, 1fr); }
  .chat-collapsed .p-chat { position: static; width: auto; height: 52px; }
  .chat-collapsed .p-chat .pc-head { justify-content: flex-end; padding: 8px 12px; }
  .chat-collapsed .pc-toggle-text { display: inline; }
  .chat-collapsed .pc-toggle { width: auto; padding: 0 9px; flex-direction: row; gap: 6px; border-radius: 8px; }
  .chat-collapsed .pc-toggle-chat { display: none; }
}
@media (prefers-reduced-motion: reduce) { .p-cols { transition: none; } }

/* ===== плашки-уведомления над экраном ===== */
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main-col > .main { flex: 1 1 auto; }
.notices { display: flex; flex: 0 0 auto; flex-direction: column; gap: 8px; padding: 12px 26px 0; }
.notices[hidden] { display: none; }
.notice-list { display: flex; flex-direction: column; gap: 8px; max-height: min(var(--notice-list-height, 150px), 45vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; scrollbar-gutter: auto; }
.notice-list:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.notice-scroll-hint { color: var(--ink3); font-size: 11px; text-align: right; }
.notice { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; min-height: var(--notice-card-height, 42px); padding: 8px 8px 8px 14px; border: 1px solid rgba(217,130,43,.38); border-radius: 9px; background: #2b1a08; color: #e8973f; font-size: 13.5px; line-height: 1.45; }
.notice .ico { flex: 0 0 auto; display: inline-flex; color: #e8973f; }
.notice .txt { flex: 1 1 auto; min-width: 0; text-wrap: pretty; }
.notice .txt b { color: #f2b56b; font-weight: 600; }
.notice-btn { flex: 0 0 auto; height: 28px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 6px; background: rgba(255,255,255,.07); color: #cdbfae; font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.notice-btn:hover { background: rgba(255,255,255,.13); color: #fff; }
.notice-x { flex: 0 0 auto; width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent; color: rgba(232,151,63,.6); font-size: 17px; line-height: 1; cursor: pointer; }
.notice-x:hover { color: #e8973f; background: rgba(255,255,255,.06); }
[data-theme="light"] .notice { background: #f6e6cc; border-color: #e2b675; color: #8a4f12; }
[data-theme="light"] .notice .ico { color: #8a4f12; }
[data-theme="light"] .notice .txt b { color: #6b3a08; }
[data-theme="light"] .notice-btn { background: rgba(0,0,0,.06); color: #6b4a2a; }
[data-theme="light"] .notice-x { color: rgba(138,79,18,.6); }

/* Общая мобильная компоновка для всех маршрутов, независимо от состояния левой панели. */
.mobile-menu-toggle, .mobile-menu-backdrop, .mobile-theme-box { display: none; }
@media (max-width: 900px) {
  .app, .app.rail-off { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100vh; height: var(--app-height, 100dvh); overflow: hidden; }
  .main-col { grid-column: 1; grid-row: 2; }
  .head { grid-column: 1; grid-row: 1; grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: 56px 44px; align-items: center; padding-top: env(safe-area-inset-top, 0px); }
  .head::after, .app.rail-off .head::after { left: 0; }
  .mobile-menu-toggle { display: inline-flex; grid-column: 1; grid-row: 1; justify-self: center; width: 40px; height: 44px; border: 0; background: transparent; }
  .brand, .app.rail-off .brand { grid-column: 2; grid-row: 1; padding: 0 6px; border: 0; gap: 8px; }
  .brand::after { display: none; }
  .brand .logo { width: 26px; }
  .brand .word, .app.rail-off .brand .word { display: flex; }
  .brand .word b { font-size: 13px; letter-spacing: 3px; }
  .brand .word span { font-size: 6.5px; letter-spacing: 1.5px; }
  .head-bar { display: contents; }
  .head-right { grid-column: 3; grid-row: 1; margin: 0; padding-right: 8px; gap: 4px; }
  .head-right #themeBox, .me-link > span:not(.avatar) { display: none; }
  .head .mail-btn, .head .me-link, .head .sound-settings-toggle { width: 44px; height: 44px; justify-content: center; }
  .tabs { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-self: stretch; gap: 0; padding: 0 8px; border-top: 1px solid var(--rule); }
  .tab { min-width: 0; justify-content: center; font-size: 13px; padding: 0 4px; }
  .mobile-menu-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 70; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(0,0,0,.55); }
  .rail { position: fixed; inset: 0 auto 0 0; z-index: 80; width: min(320px, calc(100vw - 48px)); height: var(--app-height, 100dvh); padding-top: env(safe-area-inset-top, 0px); background: var(--modal); border-right: 1px solid var(--rule2); transform: translateX(-100%); visibility: hidden; transition: transform .18s ease, visibility .18s ease; }
  .mobile-nav-open .rail { transform: translateX(0); visibility: visible; }
  .rail-top, .app.rail-off .rail-top { justify-content: space-between; margin: 0 12px; padding: 12px 0; }
  .rail-top .icon-btn { width: 44px; height: 44px; font-size: 24px; }
  .app.rail-off .rail-tabs { display: flex; }
  .rail-body:not([hidden]), .app.rail-off .rail-body:not([hidden]), .app.rail-off #railChats:not([hidden]) { display: flex; flex: 1 1 auto; margin: 0 12px; }
  .rail-foot, .app.rail-off .rail-foot { padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px)); }
  .app.rail-off .rail-foot .btn span { display: inline; }
  .mobile-theme-box { display: block; }
  .rail-foot .btn { min-height: 44px; }
  .rail-find { height: 42px; }
  .screen, .screen:has(#dChatPanel) { width: 100%; padding: 22px 16px 36px; gap: 20px; }
  .screen-head h1 { font-size: 25px; }
  .screen-head p { font-size: 14px; }
  .v5-wrap { width: 100%; max-width: 100%; gap: 22px; min-width: 0; }
  .v5-h1 { font-size: 30px; }
  .v5-lead { font-size: 14px; }
  .v5-search input { height: 50px; }
  .v5-row > .k { width: auto; flex-basis: 100%; }
  .v5-found { width: 100%; margin: 4px 0 0; }
  .v5-chip { padding: 8px 12px; min-height: 38px; }
  .v5-create { width: 100%; justify-content: center; min-height: 44px; }
  .v5-proj { padding: 22px 0; gap: 18px; }
  .v5-proj-top { flex-direction: column; gap: 14px; }
  .v5-proj-top .t { width: 100%; }
  .v5-proj-top .c { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 100%; }
  .v5-proj-top h3 { font-size: 16px; }
  .v5-cline { white-space: normal; overflow-wrap: anywhere; }
  .v5-go { width: 100%; min-width: 0; min-height: 44px; }
  /* Дерево становится вертикальным: все роли и слоты доступны без горизонтальной прокрутки. */
  .nt-head { gap: 12px; }
  .nt-status { position: static; align-self: flex-start; font-size: 12px; }
  .nt-owner { max-width: 100%; }
  .nt-owner .n { min-width: 0; overflow-wrap: anywhere; }
  .nt-scroll { overflow: visible; }
  .nt-row { width: 100%; min-width: 0; flex-direction: column; gap: 18px; }
  .nt-col, .nt-col.wide { width: 100%; min-width: 0; flex: 0 0 auto; padding: 0; }
  .nt-col .bl, .nt-col .br { display: none; }
  .nt-role, .nt-slots, .nt-slots.wide { max-width: 100%; }
  .nt-slots.wide { display: flex; flex-direction: column; padding-top: 14px; }
  .nt-slots.wide .fork, .nt-slots.wide .legl, .nt-slots.wide .legr { display: none; }
  .nt-slots.wide .trunk { height: auto; bottom: 24px; }
  .grid-4, .grid-3, .grid-2, .p-left .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .pcard { grid-template-columns: minmax(0, 1fr); padding: 20px 8px; gap: 18px; }
  .scell, .stack-card { padding: 18px 12px; }
  .s-head { flex-wrap: wrap; }
  .s-role { font-size: 14px; }
  .section-title { flex-wrap: wrap; }
  .section-title h2 { font-size: 17px; }
  .filter-row { gap: 10px; }
  .filter-row .picker { flex-basis: 100%; max-width: none; }
  .pf-row { flex-wrap: wrap; gap: 10px; }
  .pf-search { flex: 1 1 180px; width: auto; min-width: 0; }
  .pf-pills { flex: 1 1 100%; flex-wrap: wrap; overflow: visible; }
  .pf-sugg { width: min(280px, calc(100vw - 48px)); max-width: 100%; }
  .screen:has(#dChatPanel) .dev-layout, .screen:has(#dChatPanel) .dev-layout:has(.dev-dock:not([hidden])) { grid-template-columns: minmax(0, 1fr); margin-right: 0; padding-left: 0; }
  .screen:has(#dChatPanel) .dev-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px 10px; padding: 14px 0; }
  .screen:has(#dChatPanel) .dev-who { grid-column: 2; grid-row: 1; }
  .screen:has(#dChatPanel) .dev-row > .techs { grid-column: 2 / -1; grid-row: 2; }
  .screen:has(#dChatPanel) .dev-acts { grid-column: 3; grid-row: 1; gap: 4px; }
  .dev-acts .round-btn { width: 40px; height: 44px; }
  .dev-dock { position: fixed; inset: calc(108px + env(safe-area-inset-top, 0px)) 8px auto; width: auto; height: calc(var(--app-height, 100dvh) - 116px - env(safe-area-inset-top, 0px)); max-height: none; }
  .prof-head { gap: 12px; }
  .prof-head .who { min-width: 0; }
  .prof-head .who h1 { font-size: 21px; }
  .prof-acts { flex-basis: 100%; }
  .prof-acts .btn { flex: 1 1 auto; min-height: 40px; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .history-row > .faint { grid-column: 1 / -1; }
  .p-hero { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .p-hero h1 { font-size: 25px; }
  .p-actions { justify-content: flex-start; max-width: none; }
  .p-actions .btn { flex: 1 1 auto; }
  .stages { overflow-wrap: anywhere; }
  .stage { padding: 12px 8px; }
  .stage b { font-size: 12px; }
  .stage span { font-size: 11px; }
  .stage-actions { flex-wrap: wrap; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 14px 12px; }
  .workspace { padding: 16px; }
  .workspace input, .workspace a { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .workspace [style*="flex:"] { flex-basis: auto !important; min-width: 0; }
  .workspace .btn { white-space: normal; height: auto; min-height: 44px; }
  #pv { max-width: 100%; height: auto; overflow: visible; }
  .p-cols, #pv.chat-collapsed .p-cols { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .p-left { overflow: visible; padding-right: 0; }
  .p-chat { height: min(600px, calc(var(--app-height, 100dvh) - 132px)); min-height: 280px; }
  .chat-collapsed .p-chat { min-height: 0; }
  .pc-head { padding: 12px; gap: 8px; }
  .pc-head h2 { font-size: 16px; }
  .p-chat .ch-list { padding: 8px 12px 16px; }
  .p-chat .ch-form { padding: 10px 12px max(10px, env(safe-area-inset-bottom, 0px)); }
  .dm-screen { height: 100%; padding: 14px 12px max(12px, env(safe-area-inset-bottom, 0px)); gap: 14px; }
  .dm-head { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 8px; flex-shrink: 0; }
  .dm-head .back { grid-column: 1 / -1; min-height: 32px; margin: 0; }
  .dm-head > .avatar { width: 32px !important; height: 32px !important; }
  .dm-head .t a { font-size: 13px; }
  .dm-head > .btn { padding: 0 9px; min-height: 40px; }
  .dm-stack { max-height: 52px; overflow: auto; }
  .ch-msg { max-width: 94%; flex-shrink: 0; }
  .ch-list { padding: 12px 10px 8px; }
  .dm-chat .ch-form { padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
  .ib-item, .ib-group .ib-item:has(.ib-dot) { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ib-item .ib-dot { display: none; }
  .ib-acts { justify-content: flex-start; }
  .ib-acts .btn { min-height: 40px; }
  .inbox-tabs { gap: 20px; }
  .notices { padding: 8px 12px 0; }
  .notice-list { max-height: 110px; }
  .notice { flex-wrap: wrap; gap: 8px; padding: 10px; font-size: 12px; }
  .notice .txt { flex-basis: calc(100% - 72px); }
  .notice-btn { min-height: 36px; }
  .smart { width: 100%; height: var(--app-height, 100dvh); }
  .smart-head, .smart-filters { padding-left: 16px; padding-right: 16px; }
  .smart-peek { inset: 64px 8px 8px; width: auto; }
  .sm-row { grid-template-columns: 24px 44px minmax(0, 1fr); gap: 10px; padding: 14px 12px; }
  .sm-row > .btn { grid-column: 3; justify-self: start; min-height: 40px; }
  .sm-row .who .line { flex-wrap: wrap; }
  .modal-wrap { padding: 8px; height: var(--app-height, 100dvh); }
  .modal { max-height: calc(var(--app-height, 100dvh) - 16px); }
  .modal-head { padding: 16px; }
  .modal-head > div { min-width: 0; overflow-wrap: anywhere; }
  .modal-body { padding: 16px; min-height: 0; }
  .modal-foot { padding: 12px 16px 16px; }
  .modal-err { margin: 0 16px; overflow-wrap: anywhere; }
  .modal .form-grid, .slot-form .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .seg { display: flex; flex-wrap: wrap; }
  .seg label { flex: 1 1 auto; }
  .user-fulltext { max-height: calc(var(--app-height, 100dvh) - 180px); }
  .app :is(input, textarea, select), .modal-wrap :is(input, textarea, select), .smart-wrap :is(input, textarea, select) { font-size: 16px; }
  .app :is(.field, .pf-input), .modal-wrap .field { min-width: 0; }
  .picker-sugg button, .pf-sugg button { min-height: 44px; }
  #toasts { width: calc(100% - 24px); bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
  .toast { max-width: 100%; overflow-wrap: anywhere; }
}
@media (max-width: 900px) and (max-height: 520px) {
  .app:has(.dm-screen) .head { grid-template-rows: 56px; }
  .app:has(.dm-screen) .tabs { display: none; }
  .app:has(.dm-screen) .notices { display: none; }
  .dm-screen .dm-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .dm-screen .dm-head .back { grid-column: 1; }
  .dm-screen .dm-head > .avatar, .dm-screen .dm-stack { display: none; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* Защищённые фото проектов; пустая галерея не занимает места. */
.project-gallery { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
#projectGallery:empty { display: none; }
.photo-heading, .photo-actions, .photo-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-heading { justify-content: space-between; }
.photo-heading h2 { font-size: 18px; }
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo-grid:empty { display: none; }
.project-photo { position: relative; display: block; width: 100%; min-width: 0; padding: 0; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--rule); border-radius: 14px; background: rgba(0, 0, 0, .13); color: var(--ink3); cursor: zoom-in; text-align: center; }
.project-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.project-photo img:not([src]) { visibility: hidden; }
.project-photo:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.project-cover { aspect-ratio: 16 / 6; max-height: 270px; margin-bottom: 22px; }
.v5-proj-body { min-width: 0; }
.v5-proj-body.has-photos { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(240px, .9fr); gap: 32px; align-items: start; }
.v5-proj-body > .nt { min-width: 0; }
.v5-proj-body.has-photos .nt-status { position: static; align-self: flex-start; margin-bottom: 14px; }
.v5-proj-photos { min-width: 0; display: flex; justify-content: flex-end; }
.project-deck { width: 372px; max-width: 100%; padding-top: 12px; }
.project-deck.single { width: 300px; padding-top: 0; }
.deck-stack { position: relative; aspect-ratio: 3 / 4; margin: 0 32px; }
.single .deck-stack { margin: 0; }
.deck-stack button { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; overflow: hidden; cursor: zoom-in; }
.deck-stack .deck-front { z-index: 2; margin: 0; max-height: none; aspect-ratio: auto; }
.deck-stack .deck-behind { z-index: 1; transform: translate(32px, 10px) scale(.94); transform-origin: right center; opacity: .65; cursor: pointer; }
.deck-stack .deck-before { z-index: 1; transform: translate(-32px, 10px) scale(.94); transform-origin: left center; opacity: .65; cursor: pointer; }
.deck-stack .deck-behind[hidden], .deck-stack .deck-before[hidden] { display: none; }
.deck-stack img { display: block; width: 100%; height: 100%; border: 0; border-radius: 0; object-fit: cover; }
.deck-stack .deck-before img, .deck-stack .deck-behind img { filter: blur(4px); }
.deck-stack img:not([src]) { visibility: hidden; }
.deck-stack button:focus-visible, .deck-controls button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.deck-controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; }
.deck-controls button { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--gold2); font-size: 24px; cursor: pointer; }
.deck-controls span { font-size: 12px; color: var(--ink3); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .v5-proj-body.has-photos { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .v5-proj-photos { justify-content: center; }
}
.photo-state { position: absolute; inset: 0; display: grid; place-content: center; padding: 16px; font-size: 13px; overflow-wrap: anywhere; background: rgba(0, 0, 0, .16); }
.photo-state[hidden] { display: none; }
.photo-viewer { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.photo-viewer img { max-width: 100%; width: auto; height: auto; max-height: 65dvh; object-fit: contain; border-radius: 12px; }
.photo-viewer img:not([src]) { display: none; }
.photo-nav { justify-content: center; }
.photo-nav button { min-width: 48px; min-height: 44px; }
.photo-edit { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.photo-queue { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink3); font-size: 13px; }
.photo-actions > button { min-height: 44px; }
.v5-go-row { align-items: center; gap: 16px; flex-wrap: wrap; }
.project-activity { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-right: auto; min-width: 0; }
.activity-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 10px; background: transparent; color: var(--ink3); font: inherit; font-size: 13px; cursor: pointer; }
.activity-button:hover { color: var(--ink); background: var(--card-hover); }
.activity-button.is-reacted { color: var(--gold2); border-color: rgba(214, 177, 61, .45); background: rgba(214, 177, 61, .08); }
.activity-button:disabled { opacity: .55; cursor: wait; }
.activity-button:focus-visible, .comment-delete:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.project-discussion { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-width: 0; padding-top: 8px; }
.project-discussion h2 { font-size: 16px; }
.project-discussion .project-activity { margin-right: 0; }
.comments-tools { display: flex; justify-content: flex-end; margin: 14px 0; }
.comments-list { display: flex; flex-direction: column; min-width: 0; gap: 0; }
.project-comment { min-width: 0; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; min-width: 0; }
.comment-author { color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.comment-meta time { color: var(--ink4); font-size: 11px; }
.comment-delete { margin-left: auto; border: none; background: transparent; color: var(--ink3); font: inherit; font-size: 12px; cursor: pointer; }
.comment-delete:hover { color: var(--danger); }
.comment-text { min-width: 0; margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 14px; color: var(--ink2); }
.comments-status:empty { display: none; }
.project-comments-inline { min-width: 0; margin-top: 20px; padding-top: 4px; }
.project-comments-inline .comment-form { margin-top: 18px; padding: 0; border: 0; background: transparent; }
.project-comments-inline .comment-input { display: block; width: 100%; min-height: 58px; padding: 10px 0; border: 0; border-radius: 0; outline: none; box-shadow: none; background: transparent; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.6; caret-color: var(--gold); }
.project-comments-inline .comment-input::placeholder { color: var(--ink4); }
.comments-error { color: var(--danger); margin-top: 10px; font-size: 13px; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; min-width: 0; }
.comment-form textarea { min-width: 0; resize: vertical; max-height: 240px; }
.comment-compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
[data-comments-more] { margin-top: 12px; }
@media (max-width: 600px) {
  .activity-button, .comment-delete { min-height: 44px; }
  .v5-go-row .v5-go { margin-left: auto; }
  .project-discussion { align-items: flex-start; flex-direction: column; }
  .comment-compose-foot .btn { min-height: 44px; }
}
.p-side { display: flex; flex-direction: column; gap: 12px; height: 100%; min-height: 0; min-width: 0; }
.p-side > .p-chat { flex: 1 1 0; height: auto; }
#projectGalleryDock:empty, #projectGalleryDock:has(> #projectGallery:empty) { display: none; }
.project-gallery-panel { flex: none; min-width: 0; width: 100%; max-width: 420px; }
.project-gallery-panel .project-gallery { gap: 8px; }
.project-gallery-panel .photo-heading { gap: 8px; }
.project-gallery-panel .photo-heading h2 { font-size: 14px; }
.project-gallery-panel .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.project-gallery-panel .project-photo { aspect-ratio: 4 / 3; max-height: 76px; border-radius: 6px; }
@media (max-width: 1200px) {
  .p-side { height: auto; }
  .p-side > .p-chat { flex: none; height: 560px; }
  .chat-collapsed .p-side > .p-chat { height: 52px; min-height: 0; }
}
@media (max-width: 900px) {
  .p-side > .p-chat { height: min(600px, calc(var(--app-height, 100dvh) - 132px)); min-height: 280px; }
  .chat-collapsed .p-side > .p-chat { min-height: 0; }
}
@media (max-width: 600px) {
  .photo-grid { gap: 8px; }
  .project-cover { aspect-ratio: 16 / 9; }
  .photo-actions { align-items: stretch; flex-direction: column; }
  .photo-edit > button { min-height: 44px; font-size: 12px; }
  .photo-viewer img { max-height: 55dvh; }
}
