/* «Проекты» v2 (утверждённый макет projects-mock-v2, правки TG 1433).
   Своя палитра раздела по теме Telegram: светлая по умолчанию, тёмная при colorScheme = dark (класс pj-dark на html).
   Остальные разделы и общие файлы тем не меняются. Шрифт подписей не меньше 13px. */
:root {
  --pj-bg: #eef2f7; --pj-card: #ffffff; --pj-text: #141821; --pj-hint: #5f6875; --pj-link: #2f6fd6; --pj-line: rgba(20,30,50,.09);
  --pj-ring-track: #e3e8ef; --pj-ring-none: #c3cad4; --pj-run: #2a63c4; --pj-wait: #8a5c0c; --pj-stop: #b8352a; --pj-live: #1b7d4c;
  --pj-old-bg: #fff6e0; --pj-old-text: #5c4505; --pj-old-dot: #d79a10; --pj-bad-bg: #fdecea; --pj-bad-text: #8f1f16; --pj-live-bg: #e6f5ec;
  --pj-soft: #f3f5f9; --pj-btn-off: #eef1f5; --pj-btn-off-text: #8c95a2; --pj-tabs: rgba(255,255,255,.94);
}
html.pj-dark {
  --pj-bg: #0e1217; --pj-card: #1a2029; --pj-text: #eef1f5; --pj-hint: #9aa4b1; --pj-link: #6aa8f5; --pj-line: rgba(255,255,255,.08);
  --pj-ring-track: #2a323d; --pj-ring-none: #4a5462; --pj-run: #6aa8f5; --pj-wait: #e0b25a; --pj-stop: #f07b6e; --pj-live: #5fd09a;
  --pj-old-bg: #2b2512; --pj-old-text: #f0d690; --pj-old-dot: #e0b25a; --pj-bad-bg: #3a1c1a; --pj-bad-text: #ffb4aa; --pj-live-bg: #15291f;
  --pj-soft: #222935; --pj-btn-off: #232a34; --pj-btn-off-text: #7d8794; --pj-tabs: rgba(20,25,32,.94);
}

.tabs { grid-template-columns: repeat(5, 1fr); }
.tabs button { min-width: 0; }
.tabs button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
body.on-projects #banner, body.on-projects #skeleton, body.on-projects #loading { display: none !important; }

/* фон и нижняя панель на экране «Проекты» в палитре раздела */
body.on-projects { background: var(--pj-bg); color: var(--pj-text); }
body.on-projects::before, body.on-projects::after { display: none; }
body.on-projects .tabs { background: var(--pj-tabs); border-color: var(--pj-line); box-shadow: 0 6px 24px rgba(15,25,40,.12); }
body.on-projects .tabs button { color: var(--pj-hint); }
body.on-projects .tabs button[aria-current="page"] { color: var(--pj-link); background: color-mix(in srgb, var(--pj-link) 12%, transparent); box-shadow: none; }
body.on-projects .tabs button[aria-current="page"] svg { filter: none; }

#screen-projects { --text: var(--pj-text); --hint: var(--pj-hint); --line: var(--pj-line); --surface: var(--pj-card); --accent: var(--pj-link);
  --attention: var(--pj-wait); --minus: var(--pj-stop); --plus: var(--pj-live); gap: 0; padding: 6px 16px 24px; color: var(--pj-text); }
#pj-overlay { --text: var(--pj-text); --hint: var(--pj-hint); --line: var(--pj-line); --surface: var(--pj-card); --accent: var(--pj-link);
  --attention: var(--pj-wait); --minus: var(--pj-stop); --plus: var(--pj-live); }

/* шапка */
.pj-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
#screen-projects .pj-head h1 { font-family: inherit; font-style: normal; font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; padding: 0; color: var(--pj-text); }
.pj-head-btns { display: flex; gap: 8px; align-items: center; }
#pj-filt-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--pj-card); border: 1px solid var(--pj-line); color: var(--pj-hint); }
#pj-filt-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#pj-filt-btn.on { color: var(--pj-link); border-color: var(--pj-link); }
#pj-reread { flex: none; min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--pj-link);
  background: var(--pj-card); border: 1px solid var(--pj-line); }
.pj-sum { margin: 6px 0 0; font-size: 16px; line-height: 1.4; color: var(--pj-hint); }
.pj-sum b { color: var(--pj-stop); font-weight: 700; white-space: nowrap; }
.pj-sum .pj-last { color: var(--pj-wait); font-weight: 700; }
#pj-status { margin: 4px 0 0; font-size: 13px; color: var(--pj-hint); }
#pj-loading { padding: 24px 8px; text-align: center; color: var(--pj-hint); }
#screen-projects .banner { margin: 12px 0 0; }

/* плашка свежести */
.pj-lines { margin-top: 14px; display: grid; gap: 8px; }
.pj-fresh { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 10px 12px 10px 14px; border-radius: 16px; border: 0; text-align: left; font: inherit; font-size: 14px; line-height: 1.4; cursor: pointer;
  background: var(--pj-old-bg); color: var(--pj-old-text); }
.pj-fresh > i { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: var(--pj-old-dot); }
.pj-fresh > div, .pj-fresh > span:not(.pj-chev) { min-width: 0; flex: 1; display: block; overflow-wrap: anywhere; }
.pj-fresh > .pj-chev { align-self: center; color: inherit; opacity: .7; }
.pj-fresh[aria-expanded="true"] > .pj-chev { transform: rotate(90deg); }
.pj-fresh p { margin: 0; overflow-wrap: anywhere; }
.pj-fresh b { font-weight: 700; }
.pj-fresh.c-live { background: var(--pj-live-bg); color: var(--pj-text); } .pj-fresh.c-live > i { background: var(--pj-live); }
.pj-fresh.c-bad { background: var(--pj-bad-bg); color: var(--pj-bad-text); } .pj-fresh.c-bad > i { background: var(--pj-stop); }
.pj-lines-sum { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0; margin-top: 2px; font-size: 14px; font-weight: 700;
  text-align: left; background: none; border: 0; color: inherit; }
.pj-lines-sum span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.pj-chev { display: inline-block; font-size: 20px; line-height: 1; color: var(--pj-hint); transition: transform .15s; text-decoration: none; }
.pj-lines-sum[aria-expanded="true"] .pj-chev, details[open] > summary .pj-chev { transform: rotate(90deg); }
.pj-lines-list { display: grid; padding: 4px 16px; border-radius: 18px; background: var(--pj-card); }
.pj-line { padding: 10px 0; border-bottom: 1px solid var(--pj-line); }
.pj-line:last-child { border-bottom: 0; }
.pj-line-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pj-line-top b { font-weight: 700; min-width: 0; }
.pj-line .sub { margin-top: 2px; font-size: 13px; line-height: 1.4; }
.pad { padding: 8px 0; }

/* фильтры: свёрнуты, чтобы главный экран был как в макете */
.pj-filt { margin-top: 10px; display: grid; gap: 8px; }
.pj-filt[hidden] { display: none; }
.pj-filt > summary { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 4px; font-size: 14px; font-weight: 700; color: var(--pj-hint); cursor: pointer; list-style: none; }
.pj-filt > summary::-webkit-details-marker, .pj-closed > summary::-webkit-details-marker, .pj-fold > summary::-webkit-details-marker { display: none; }
.pj-filt[open] { display: grid; gap: 8px; }
#screen-projects .chips button { min-height: 44px; font-size: 13px; background: var(--pj-card); color: var(--pj-hint); border: 1px solid var(--pj-line); }
#screen-projects .chips button[aria-pressed="true"] { background: var(--pj-text); color: var(--pj-bg); }
#screen-projects .chips button.bad:not([aria-pressed="true"]) { color: var(--pj-stop); }
.pj-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* 16px: меньший шрифт в select даёт зум страницы при фокусе в iOS WebView */
.pj-selects select { width: 100%; min-height: 44px; padding: 0 10px; border-radius: 12px; font-size: 16px; font-weight: 600;
  background: var(--pj-card); color: var(--pj-text); border: 1px solid var(--pj-line); }
.pj-selects option { color: #111; }
.pj-active:empty { display: none; }
.pj-active { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 0 4px; font-size: 13px; color: var(--pj-hint); }
.pj-active button, .pj-empty button { min-height: 44px; padding: 0 14px; border-radius: 999px; font-weight: 700; color: var(--pj-link);
  background: var(--pj-card); border: 1px solid var(--pj-line); }
.pj-empty { display: grid; justify-items: center; gap: 10px; }

/* разделы */
#pj-list { display: grid; gap: 0; }
.pj-group > h2 { margin: 24px 2px 12px; padding: 0; font-size: 18px; font-weight: 700; color: var(--pj-text); }
.pj-group > h2 .muted { font-weight: 600; color: var(--pj-hint); }
.pj-group > h2.bad { color: var(--pj-text); }
.pj-more, .pj-closed > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 12px 18px;
  border-radius: 18px; background: var(--pj-soft); color: var(--pj-hint); font-size: 15px; text-align: left; border: 0; margin-bottom: 12px; cursor: pointer; list-style: none; }
.pj-more b, .pj-closed > summary b { font-weight: 700; color: var(--pj-text); }
.pj-closed { margin-top: 22px; }
/* TG 1463: неброская кнопка внизу главной, список завершённых отдельным экраном */
.pj-closed-btn { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 48px; margin: 18px 0 12px; padding: 12px 18px;
  border: 0; border-radius: 18px; background: transparent; box-shadow: inset 0 0 0 1px var(--pj-soft); color: var(--pj-hint); font-size: 15px; text-align: left; cursor: pointer; }
.pj-closed-back { margin-top: 8px; }
.pj-closed > summary { background: var(--pj-card); }
.pj-sub { margin: 14px 4px 10px; font-size: 15px; font-weight: 700; color: var(--pj-hint); }

/* карточка */
.pj-card { display: flex; gap: 10px; align-items: center; width: 100%; padding: 18px 14px 18px 12px; margin-bottom: 12px; border-radius: 24px; text-align: left;
  background: var(--pj-card); color: var(--pj-text); border: 0; box-shadow: 0 1px 2px rgba(15,25,40,.04); }
.pj-card:active { opacity: .78; }
.pj-err { display: block; }
.pj-ring { flex: none; position: relative; display: grid; place-items: center; }
.pj-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; }
.pj-ring .none { stroke: var(--pj-ring-none); stroke-width: 2; }
.pj-ring .track { stroke: var(--pj-ring-track); stroke-width: 6; }
.pj-ring .arc { stroke: var(--pj-live); stroke-width: 6; stroke-linecap: round; }
.pj-ring small { position: relative; max-width: 88%; font-size: 13px; line-height: 1.12; font-weight: 600; text-align: center; color: var(--pj-hint); }
.pj-ring .pj-pct { position: relative; display: grid; justify-items: center; line-height: 1; }
.pj-ring .pj-pct small { font-size: 13px; font-weight: 500; margin-top: 2px; }
.pj-ring i { position: relative; font-style: normal; font-size: 20px; font-weight: 700; color: var(--pj-text); letter-spacing: -.02em; }
.pj-main { display: grid; gap: 5px; min-width: 0; flex: 1; }
.pj-title { font-size: 18px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pj-age-line { font-size: 13px; line-height: 1.35; color: var(--pj-hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-state { font-size: 15px; line-height: 1.35; }
.pj-state b { font-weight: 700; font-size: 14px; }
.pj-hero .pj-state b { font-size: 15px; }
.pj-state small { font-size: 13px; font-weight: 400; color: var(--pj-hint); white-space: nowrap; letter-spacing: -.01em; }
.pj-age-in { font-size: 13px; color: var(--pj-hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pj-age-in.c-bad { color: var(--pj-stop); }
.pj-note .c-bad { color: var(--pj-stop); }
.pj-ctl { margin: 16px 4px 0; font-size: 14px; line-height: 1.5; color: var(--pj-hint); }
.pj-link { display: inline; min-height: 44px; padding: 10px 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--pj-link); text-decoration: underline; text-underline-offset: 3px; }
.pj-state .pj-who { color: var(--pj-hint); } .pj-state .pj-who.c-alert { color: var(--pj-stop); }
.c-run { color: var(--pj-run); } .c-wait { color: var(--pj-wait); } .c-stop, .c-alert { color: var(--pj-stop); } .c-done { color: var(--pj-hint); } .c-soon { color: var(--pj-wait); }
.pj-note { font-size: 15px; line-height: 1.35; color: var(--pj-hint); overflow-wrap: anywhere;
}
.pj-note.c-alert, .pj-note .c-alert { color: var(--pj-stop); } .pj-note .c-soon { color: var(--pj-wait); }
.pj-age { display: flex; gap: 6px; align-items: baseline; margin-top: 3px; font-size: 13px; line-height: 1.35; color: var(--pj-hint); }
.pj-age i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--pj-old-dot); transform: translateY(-1px); }
.pj-age.c-live { color: var(--pj-live); } .pj-age.c-live i { background: var(--pj-live); }
.pj-age.c-bad { color: var(--pj-stop); } .pj-age.c-bad i { background: var(--pj-stop); }
.pj-flag { font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.pj-flag.c-bad { color: var(--pj-stop); } .pj-flag.c-old { color: var(--pj-wait); }
.pj-foot { margin: 22px 4px 0; font-size: 15px; line-height: 1.4; color: var(--pj-hint); text-align: center; }

/* карточка проекта: шторка почти на весь экран */
#pj-overlay { align-items: flex-end; }
#pj-sheet { max-height: 96vh; height: 96vh; padding: 0 14px calc(20px + var(--bottom-inset, 0px)); background: var(--pj-bg); color: var(--pj-text);
  border: 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
#pj-sheet .sheet-heading { position: sticky; top: 0; z-index: 3; padding: 10px 0 8px; background: var(--pj-bg); }
#pj-sheet .sheet-heading h2 { font-family: inherit; font-style: normal; font-size: 16px; font-weight: 700; color: var(--pj-hint); }
#pj-sheet-title { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
#pj-sheet-close { width: 44px; height: 44px; min-width: 44px; font-size: 26px; color: var(--pj-hint); }
#pj-sheet:focus-visible { outline: none; }
.pj-hero { display: flex; gap: 16px; align-items: center; padding: 20px 18px; border-radius: 24px; background: var(--pj-card); }
.pj-title-full { font-size: 19px; display: block; -webkit-line-clamp: unset; overflow: visible; }
/* «Что сейчас»: подпись над значением, текст во всю ширину */
.pj-now .pj-kv, .pj-kv.pj-tech { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.pj-now .pj-kv dt, .pj-tech dt { margin-top: 10px; font-size: 13px; font-weight: 600; }
.pj-now .pj-kv dt:first-child, .pj-tech dt:first-child { margin-top: 0; }
.pj-alert { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 0; padding: 12px 14px; border-radius: 16px; font-size: 14px; line-height: 1.42; overflow-wrap: anywhere; }
.pj-alert i { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; }
.pj-alert.c-old { background: var(--pj-old-bg); color: var(--pj-old-text); } .pj-alert.c-old i { background: var(--pj-old-dot); }
.pj-alert.c-bad { background: var(--pj-bad-bg); color: var(--pj-bad-text); } .pj-alert.c-bad i { background: var(--pj-stop); }
.pj-box { margin-top: 12px; padding: 18px; border-radius: 24px; background: var(--pj-card); }
.pj-box h3 { margin: 0 0 12px; font-size: 17px; font-weight: 700; }
.pj-box h4 { margin: 14px 0 6px; font-size: 13px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--pj-hint); }
.pj-kv { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px 12px; margin: 0; font-size: 15px; line-height: 1.42; }
.pj-kv dt { color: var(--pj-hint); font-size: 14px; }
.pj-kv dd { margin: 0; overflow-wrap: anywhere; }
.pj-kv dd.c-miss { color: var(--pj-hint); }
.pj-kv dd.c-alert { color: var(--pj-stop); } .pj-kv dd.c-soon { color: var(--pj-wait); }
.pj-tech { font-size: 14px; }
.pj-tech dd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.pj-fold { padding: 0; }
.pj-fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 14px 18px; cursor: pointer; list-style: none;
  font-size: 17px; font-weight: 700; }
.pj-fold > summary > span:first-child { display: grid; gap: 1px; min-width: 0; }
.pj-fold > summary small { font-size: 13px; font-weight: 500; color: var(--pj-hint); }
.pj-fold-body { padding: 0 18px 18px; }
.pj-text { margin: 0; white-space: pre-line; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.pj-ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.pj-ul li { position: relative; padding-left: 16px; font-size: 14.5px; line-height: 1.42; overflow-wrap: anywhere; }
.pj-ul li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--pj-hint); }
.pj-why { margin: 12px 0 0; font-size: 14px; line-height: 1.42; color: var(--pj-hint); }
.pj-miss { margin: 0; font-size: 15px; color: var(--pj-hint); }
.pj-files { display: grid; margin-top: 8px; }
.pj-file { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--pj-line); font-size: 15px; }
.pj-file span:last-child { color: var(--pj-hint); text-align: right; font-size: 14px; }
.pj-hist { list-style: none; margin: 0; padding: 0; }
.pj-hist li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--pj-line); font-size: 15px; line-height: 1.38; overflow-wrap: anywhere; }
.pj-hist li:first-child { border-top: 0; padding-top: 0; }
.pj-hist time { color: var(--pj-hint); font-size: 14px; }
.pj-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pj-stages li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 6px; font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.pj-stages li .sub { display: block; font-size: 13px; }
.pj-stages .pj-mark { color: var(--pj-hint); text-align: center; }
.pj-stages li.ok .pj-mark { color: var(--pj-live); } .pj-stages li.now .pj-mark { color: var(--pj-run); }
.pj-docs, .pj-acts { display: grid; gap: 10px; margin-top: 8px; }
.pj-docs button, .pj-reread, .pj-back { display: grid; gap: 2px; min-height: 44px; padding: 10px 14px; border-radius: 14px; font-weight: 700; text-align: left;
  background: var(--pj-soft); color: var(--pj-text); border: 0; }
.pj-reread { color: var(--pj-link); }
.pj-reread .sub { font-size: 13px; font-weight: 500; color: var(--pj-hint); }
.pj-acts-off { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pj-acts-off button { min-height: 44px; padding: 10px; border-radius: 14px; font-size: 15px; font-weight: 600; background: var(--pj-btn-off); color: var(--pj-btn-off-text); border: 0; cursor: not-allowed; }
.pj-reread-msg { color: var(--pj-link); }
.pj-back { margin: 4px 0 10px; width: auto; justify-self: start; }
.pj-doc { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 12px; border-radius: 12px;
  background: var(--pj-card); max-width: 100%; }
body.pj-lock { overflow: hidden; }

@media (max-width: 360px) {
  .tabs button span { font-size: 10px; letter-spacing: -.02em; }
  .pj-selects select { padding: 0 6px; font-size: 16px; }
  .pj-card { padding: 16px 12px; gap: 12px; }
  .pj-kv { grid-template-columns: 88px minmax(0, 1fr); }
}

/* TG 1463: переключатель «Активные | Завершённые», карточки без круга, строка этапа, «От вас» */
.pj-tabs { display: flex; gap: 4px; padding: 4px; margin: 4px 0 8px; border-radius: 999px; background: var(--pj-card); border: 1px solid var(--pj-line); }
.pj-tabs button { flex: 1; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--pj-hint); font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap; }
.pj-tabs button[aria-selected="true"] { background: var(--pj-link); color: #fff; }
.pj-sum-line { display: block; }
.pj-stage-line .pj-src { font-size: 13px; font-weight: 400; color: var(--pj-hint); white-space: normal; }
.pj-stage { display: block; font-size: 15px; line-height: 1.35; color: var(--pj-text); margin-top: 2px; }
.pj-you { display: block; font-size: 14px; line-height: 1.35; color: var(--pj-hint); margin-top: 2px; }
.pj-you.c-alert { color: var(--pj-stop); font-weight: 600; }
.pj-stage-line .c-miss { color: var(--pj-hint); }

/* 4 вкладки внизу после объединения (TG 3086) */
.tabs { grid-template-columns: repeat(5, 1fr); }
