@font-face { font-family: 'Inter'; src: url('InterVariable.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
:root {
  --bg:#f6f7f9; --panel:#fff; --ink:#15171c; --muted:#646b79; --faint:#98a0ad; --line:#e6e8ee; --line2:#f0f1f4;
  --hot:#d6452f; --hot-soft:#fdeee9; --warm:#b87108; --warm-soft:#fff5e1; --ok:#1f8a5b; --ok-soft:#e8f6ef;
  --acc:#2f5bd3; --acc-soft:#ecf1ff; --rail:#101318;
  --r:12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 13px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }

#app { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
/* ── левая навигация ── */
#rail { background: var(--rail); color: #c9ced8; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 750; font-size: 15px; padding: 4px 10px 18px; letter-spacing: -.01em; display: flex; gap: 8px; align-items: center; }
.brand i { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg,#5b8cff,#7c5cff); display: inline-block; }
#rail nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px; font-weight: 500; color: #c9ced8; }
.nav:hover { background: #181c24; color: #fff; }
.nav.on { background: #1e232c; color: #fff; }
.nav b { font-weight: 600; font-size: 11.5px; background: #2a303b; color: #dfe3ea; border-radius: 10px; padding: 1px 7px; }
.nav b.hot { background: var(--hot); color: #fff; }
.rail-sep { height: 1px; background: #232833; margin: 12px 6px; }
.rail-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #7a8190; padding: 4px 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.nav .l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rail-foot { margin-top: auto; font-size: 11.5px; color: #98a0ae; padding: 12px 10px 4px; border-top: 1px solid #232833; line-height: 1.55; }
.rail-foot a:hover { color: #fff; }
.rail-foot .ok { color: #5fd3a0; } .rail-foot .warn { color: #f0b45a; } .rail-foot .bad { color: #ff7d6b; }

/* ── шапка ── */
#main { padding: 20px 28px 48px; min-width: 0; }
#top { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.back { font-size: 12.5px; color: var(--muted); padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; white-space: nowrap; }
.back:hover { color: var(--ink); border-color: #cfd3dc; }
.ttl-box { min-width: 0; }
#top h1 { font-size: 21px; font-weight: 720; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
#top .sub a { text-decoration: underline; text-decoration-color: #c4c9d3; text-underline-offset: 2px; }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; height: 36px; color: var(--faint); cursor: text; }
.search:focus-within { border-color: var(--acc); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%; color: var(--ink); -webkit-appearance: none; appearance: none; }
.search kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; color: var(--muted); }
.btn { background: #fff; border: 1px solid #d9dce4; border-radius: 9px; padding: 0 14px; height: 36px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: #f4f5f8; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #2a2e38; }
.btn.danger { color: var(--hot); border-color: #f0c4bb; }
.btn.danger:hover { background: var(--hot-soft); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.spin { width: 13px; height: 13px; border: 2px solid #c9ced8; border-top-color: var(--ink); border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

#banner { border-radius: 10px; padding: 9px 14px; margin-bottom: 14px; font-weight: 500; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#banner.warn { background: var(--warm-soft); color: #7a4a05; border: 1px solid #f3dca8; }
#banner.bad { background: var(--hot-soft); color: #9c2a19; border: 1px solid #f4c7bd; }
#banner a { margin-left: auto; font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }

/* ── карточки-числа ── */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; position: relative; display: block; width: 100%; transition: border-color .12s, box-shadow .12s; }
.kpi:hover { border-color: #c9cfdb; box-shadow: 0 2px 8px rgba(20,24,36,.07); }
.kpi .t { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; }
.kpi .t i { font-style: normal; color: var(--faint); font-weight: 500; }
.kpi .v { font-size: 28px; font-weight: 720; letter-spacing: -.02em; margin-top: 2px; line-height: 1.15; }
.kpi .s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.kpi.hot.on-fire { border-color: #f4c7bd; background: linear-gradient(180deg,#fff,#fff7f5); } .kpi.hot.on-fire .v { color: var(--hot); }
.kpi.warm .v { color: var(--warm); } .kpi.done .v { color: var(--ok); }
.kpi .bar { display: flex; gap: 3px; margin-top: 8px; height: 5px; } .kpi .bar span { height: 5px; border-radius: 3px; min-width: 4px; }
.kpis-wrap { position: relative; }

/* ── карточки/списки ── */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; container: card / inline-size; }
.card.alert { border-color: #f4c7bd; }
.card > h2 { font-size: 14px; font-weight: 680; padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.card > h2 .c { color: var(--muted); font-weight: 550; }
.card > h2 .r { margin-left: auto; font-size: 12px; color: var(--acc); font-weight: 600; }
.card > h2 a.r:hover { text-decoration: underline; }
.card.alert > h2 { color: var(--hot); }
.grp { padding: 8px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 7px; background: #fbfbfc; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); width: 100%; }
.card > .grp:first-of-type, .card > h2 + .grp { border-top: 0; }
button.grp { cursor: pointer; }
button.grp:hover { background: #f3f4f7; }
.grp .chev { width: 14px; display: inline-block; transition: transform .12s; color: var(--faint); font-size: 10px; }
.grp[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.grp .gt { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--ink); font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.grp .gn { margin-left: auto; font-weight: 600; letter-spacing: 0; }
.grp-wrap { display: flex; align-items: stretch; }
.grp-wrap button.grp { flex: 1; min-width: 0; }
.grp-wrap a.glink { display: flex; align-items: center; padding: 0 16px; font-size: 12px; color: var(--acc); font-weight: 600; background: #fbfbfc; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); white-space: nowrap; }
.grp-wrap a.glink:hover { text-decoration: underline; }
.more-link { display: block; padding: 9px 16px; font-size: 12.5px; color: var(--acc); font-weight: 600; border-bottom: 1px solid var(--line2); }
.more-link:hover { background: #f7f9ff; }

/* строка задачи */
.row { display: grid; grid-template-columns: minmax(0, 1fr) 118px 148px auto; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line2); cursor: pointer; position: relative; }
.row:last-child { border-bottom: 0; }
.row:hover { background: #f8f9fc; }
.row .ttl { font-weight: 580; font-size: 13.2px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .crumb { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.row .crumb .pj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.row .crumb .src { color: var(--faint); font-size: 11px; white-space: nowrap; }
.stage { font-size: 12px; color: #4a5160; display: flex; align-items: center; gap: 6px; }
.stage::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #c3c8d2; flex: none; }
.stage.s-review::before { background: #6c8fe8; } .stage.s-signing::before { background: #3fb58b; } .stage.s-doing::before { background: #8b93a3; } .stage.s-todo::before { background: #d3d7de; }
.age { font-size: 12px; color: var(--muted); } .age.hot { color: var(--hot); font-weight: 650; } .age.warm { color: var(--warm); font-weight: 600; }
.age small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 11px; font-weight: 500; opacity: .9; overflow-wrap: anywhere; }
.r-links { display: flex; gap: 5px; justify-content: flex-end; align-items: center; min-width: 0; }
.ic { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--muted); background: #fff; }
a.ic:hover { border-color: #b9bfcc; color: var(--ink); }
.ic.pyrus { color: #e0662c; } .ic.kaiten { color: #7c5cff; } .ic.tracker { color: #e5484d; } .ic.wt_board { color: #0f9d77; } .ic.tg { color: #2a9fd8; } .ic.drive { color: #b38f00; }
.more { width: 26px; height: 24px; border-radius: 6px; color: var(--muted); display: grid; place-items: center; font-weight: 700; letter-spacing: 1px; }
.more:hover { background: #eceef3; color: var(--ink); }
.r-acts { display: none; }
.done-mark { color: var(--ok); }

/* входящие */
.cand { padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.cand:last-child { border-bottom: 0; }
.cand .src { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cand .src .conf { margin-left: auto; color: var(--ok); font-weight: 650; }
.cand .src .conf.low { color: var(--warm); }
.cand .q { font-size: 12.8px; margin: 7px 0; color: #2b303a; background: #f7f8fa; border-left: 3px solid #d8dce3; padding: 6px 10px; border-radius: 0 6px 6px 0; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 9.5em; overflow: auto; }
.cand .guess { font-size: 12.8px; } .cand .guess b { font-weight: 650; }
.cand .guess .muted { color: var(--muted); }
.cand .btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cand .ev { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ── пустые состояния, скелетоны ── */
.empty { padding: 28px 20px; text-align: center; color: var(--muted); max-width: 520px; margin: 0 auto; }
.empty b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.empty a { color: var(--acc); font-weight: 600; }
.empty.pad { padding: 44px 20px; }
.skel { background: linear-gradient(90deg,#eceef2 25%,#f6f7f9 50%,#eceef2 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.skel-row { height: 46px; margin: 8px 16px; }
.skel-kpi { height: 84px; border-radius: 12px; }

/* ── заголовок списка ── */
.list-head { margin-bottom: 14px; }
.list-head h2 { font-size: 18px; font-weight: 720; }
.list-head p { color: var(--muted); margin-top: 2px; max-width: 760px; }
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; color: #3d4452; }
.chip:hover { border-color: #c4cad6; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip em { font-style: normal; font-weight: 500; opacity: .7; }
.field { height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 0 10px; min-width: 220px; outline: 0; }
.field:focus { border-color: var(--acc); }
.shown { color: var(--muted); font-size: 12px; margin-left: auto; }
.toggle { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; font-weight: 550; color: #3d4452; }
.toggle input { accent-color: var(--ink); width: 15px; height: 15px; }

/* ── проекты ── */
.wp-sec { margin-bottom: 18px; }
.wp-sec > h2 { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wp-sec > h2 .c { color: var(--muted); font-weight: 550; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line2); }
.prow:last-child { border-bottom: 0; }
.prow:hover { background: #f8f9fc; }
.prow .pt { font-weight: 620; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pm { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.prow .pn { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.prow .pn a { white-space: nowrap; }
.prow .pn a:hover { text-decoration: underline; }
.prow .pn b { font-weight: 700; color: var(--ink); }
.prow .pn .h b { color: var(--hot); } .prow .pn .h { color: var(--hot); font-weight: 600; }
.prow .pn .z { opacity: .55; }
.prow .go { color: var(--faint); font-size: 16px; }
.ops-lbl { padding: 6px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 650; background: #fbfbfc; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hid { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── досье ── */
.phead { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px; }
.phead .path { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.phead h1 { font-size: 22px; font-weight: 740; letter-spacing: -.015em; margin: 4px 0 10px; overflow-wrap: anywhere; }
.facts { display: flex; gap: 8px 28px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.facts b { color: var(--ink); font-weight: 600; display: block; }
.lnk { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.lnk a { border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; font-weight: 550; font-size: 12.5px; background: #fff; }
.lnk a:hover { border-color: #b9bfcc; background: #f8f9fc; }
.dos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.mxw { overflow-x: auto; }
.mx { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mx th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 650; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fbfbfc; }
.mx th.c, .mx td.c { text-align: center; }
.mx td { padding: 7px 12px; border-bottom: 1px solid var(--line2); }
.mx td.who { font-weight: 600; max-width: 260px; overflow-wrap: anywhere; }
.st { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; font-size: 13px; font-weight: 700; }
button.st:hover { box-shadow: 0 0 0 2px rgba(47,91,211,.25); }
.st.ok { background: var(--ok-soft); color: var(--ok); } .st.w { background: var(--acc-soft); color: var(--acc); }
.st.p { background: var(--warm-soft); color: var(--warm); } .st.n { background: #f1f3f6; color: #7b8393; }
.dash { color: #c3c8d2; }
.legend { font-size: 11.5px; color: var(--muted); padding: 8px 16px; border-top: 1px solid var(--line); }
.legend span { margin-right: 14px; white-space: nowrap; }
.tl { padding: 4px 16px 10px; }
.tl .e { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eceef2; font-size: 12.5px; }
.tl .e:last-child { border-bottom: 0; }
.tl .tm { color: var(--muted); font-size: 11.5px; }
.tl .sx { font-size: 11px; color: var(--muted); }
.tl a.ex { color: var(--acc); }
.aliases { font-size: 11px; color: var(--faint); margin-top: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.aliases span { display: inline-block; background: #eef0f4; border-radius: 5px; padding: 0 6px; margin: 0 4px 3px 0; color: #6b7280; }

/* ── карточка задачи ── */
#scrim { position: fixed; inset: 0; background: rgba(16,19,24,.38); z-index: 40; }
#drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100vw; background: #fff; z-index: 50; box-shadow: -8px 0 32px rgba(16,19,24,.16); display: flex; flex-direction: column; animation: slide .16s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
.d-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); position: relative; }
.d-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.d-close:hover { background: #eef0f4; color: var(--ink); }
.d-path { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; padding-right: 34px; flex-wrap: wrap; }
.d-path a { text-decoration: underline; text-decoration-color: #c4c9d3; text-underline-offset: 2px; }
.d-head h2 { font-size: 17px; font-weight: 700; line-height: 1.3; margin-top: 5px; padding-right: 30px; overflow-wrap: anywhere; }
.d-body { padding: 14px 20px 24px; overflow-y: auto; flex: 1; }
.d-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 8px; background: #f1f3f6; color: #3d4452; }
.pill.hot { background: var(--hot-soft); color: var(--hot); } .pill.warm { background: var(--warm-soft); color: var(--warm); } .pill.ok { background: var(--ok-soft); color: var(--ok); }
.d-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.d-form { background: #f7f8fa; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.d-form label { font-size: 12px; color: var(--muted); width: 100%; }
.d-form textarea { width: 100%; min-height: 64px; border: 1px solid #d5d9e2; border-radius: 8px; padding: 8px 10px; background: #fff; font: inherit; resize: vertical; }
.d-form input { flex: 1; min-width: 160px; height: 32px; border: 1px solid #d5d9e2; border-radius: 8px; padding: 0 10px; background: #fff; }
.d-sec { margin-top: 18px; }
.d-sec h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin-bottom: 6px; }
.dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 12.8px; }
.dl dt { color: var(--muted); } .dl dd { overflow-wrap: anywhere; }
.d-links { display: flex; flex-direction: column; gap: 6px; }
.d-links a { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; font-weight: 600; }
.d-links a:hover { background: #f8f9fc; border-color: #b9bfcc; }
.d-links a span { margin-left: auto; color: var(--faint); }
.d-sum { font-size: 12.8px; background: #f7f8fa; border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── окна и тосты ── */
#modal { position: fixed; inset: 0; z-index: 70; background: rgba(16,19,24,.42); display: grid; place-items: center; padding: 16px; }
.mbox { background: #fff; border-radius: 14px; width: 460px; max-width: 100%; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(16,19,24,.3); }
.mbox h3 { padding: 14px 18px 8px; font-size: 15px; font-weight: 700; }
.mbox .mb { padding: 0 18px 14px; overflow-y: auto; flex: 1; }
.mbox .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.pick { display: flex; flex-direction: column; margin-top: 8px; }
.pick button { padding: 8px 10px; border-radius: 8px; display: flex; gap: 8px; align-items: center; }
.pick button:hover, .pick button:focus-visible { background: #f1f4fb; }
.pick .wl { color: var(--muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast { pointer-events: auto; background: #1b1f27; color: #fff; border-radius: 10px; padding: 10px 14px; display: flex; gap: 14px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 500; max-width: 100%; animation: tin .18s ease-out; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.toast.err { background: #8e2514; }
.toast button { color: #8fb0ff; font-weight: 700; white-space: nowrap; padding: 2px 4px; }
.toast.err button { color: #ffd2c9; }
.toast .tx { overflow-wrap: anywhere; }

/* таблица источников */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.tbl th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 650; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #fbfbfc; }
.tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line2); vertical-align: top; overflow-wrap: anywhere; }
.tbl tr:last-child td { border-bottom: 0; }
.bad-t { color: var(--hot); font-weight: 600; } .warm-t { color: var(--warm); font-weight: 600; } .ok-t { color: var(--ok); font-weight: 600; }
.tblw { overflow-x: auto; }
.act-it { padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.act-it:last-child { border-bottom: 0; }
.act-it pre { font: 11.5px/1.45 ui-monospace, monospace; background: #f7f8fa; padding: 6px 8px; border-radius: 6px; margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 130px; overflow: auto; }

#tabbar { display: none; }
.search-m { display: none; }
.row .ms { display: contents; }
.st.dg { background: #e8ebf1; color: #2b303a; }
.err-box { background: #fff; border: 1px solid #f4c7bd; border-radius: 12px; padding: 20px; max-width: 520px; margin: 30px auto; text-align: center; }
.err-box b { color: var(--hot); display: block; margin-bottom: 6px; font-size: 15px; }
.err-box a, .err-box button { color: var(--acc); font-weight: 650; text-decoration: underline; }

@container card (max-width: 620px) {
  .row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 5px; }
  .row .ms { display: flex; grid-column: 1; gap: 4px 14px; flex-wrap: wrap; align-items: baseline; }
  .row .ms .age { display: block; }
  .row .r-links { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
  .row .r-acts { grid-column: 1 / -1; }
}
/* ── планшет и уже ── */
@media (max-width: 1180px) {
  .cols, .dos { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  #app { display: block; }
  #rail { display: none; }
  #main { padding: 10px 12px calc(86px + env(safe-area-inset-bottom)); }
  #top { flex-wrap: wrap; gap: 6px 10px; margin-bottom: 10px; position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 6px 0; }
  .back { order: 0; padding: 7px 10px; font-size: 12px; }
  .ttl-box { order: 1; flex: 1; }
  #top h1 { font-size: 19px; }
  .top-right { order: 2; margin-left: 0; }
  .search { display: none; }
  .btn { height: 38px; }
  #sync { padding: 0 10px; font-size: 12.5px; }
  .kpis-wrap::after { content: 'Листайте вправо, чтобы увидеть остальные числа →'; display: block; text-align: right; font-size: 11px; font-weight: 600; color: var(--muted); margin: -4px 2px 12px; }
  .kpis-wrap { position: relative; }
  .kpis-wrap::before { content: ''; position: absolute; right: -12px; top: 0; bottom: 30px; width: 36px; background: linear-gradient(90deg, rgba(246,247,249,0), var(--bg)); pointer-events: none; z-index: 1; }
  .kpis-wrap.end::before { display: none; }
  .dl-d { display: none; }
  #top .sub { font-size: 11.5px; }
  .kpis-wrap.end::after { display: none; }
  .kpis { display: flex; overflow-x: auto; gap: 8px; margin: 0 -12px 12px; padding: 0 12px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .kpis::-webkit-scrollbar { display: none; }
  .kpi { flex: none; width: 128px; scroll-snap-align: start; padding: 10px 12px; }
  .kpi .v { font-size: 24px; }
  .card { border-radius: 12px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px 14px; }
  .row .stage { display: inline-flex; } .row .age { display: block; }
  .row .ms { display: flex; gap: 4px 14px; align-items: baseline; flex-wrap: wrap; }
  .r-links { justify-content: flex-start; }
  .row .r-links, .row .ms, .row .r-acts { grid-column: auto; grid-row: auto; }
  .r-links .more { display: none; }
  .ic { width: 30px; height: 30px; }
  .r-acts { display: flex; gap: 8px; margin-top: 4px; }
  .r-acts button { flex: 1; height: 40px; border: 1px solid #d5d9e2; border-radius: 10px; font-weight: 650; text-align: center; background: #fff; }
  .r-acts button.p { background: var(--ink); color: #fff; border-color: var(--ink); }
  .grp { padding: 10px 14px; }
  .cand { padding: 14px; }
  .cand .btns .btn { flex: 1; height: 42px; }
  .tools { gap: 8px; }
  .field { width: 100%; min-width: 0; height: 40px; }
  .chip { height: 34px; }
  .shown { margin-left: 0; width: 100%; }
  .prow { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px 14px; }
  .prow .go { display: none; }
  .prow .pn { flex-wrap: wrap; gap: 6px 14px; }
  .phead { padding: 14px; }
  .phead h1 { font-size: 19px; }
  .facts { gap: 8px 20px; }
  #drawer { width: 100vw; }
  .dl { grid-template-columns: 104px minmax(0, 1fr); }
  .d-acts .btn { flex: 1 1 44%; height: 42px; }
  .d-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  #tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); }
  #tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; position: relative; }
  #tabbar a.on { color: var(--ink); font-weight: 750; }
  #tabbar svg { width: 22px; height: 22px; }
  #tabbar b { position: absolute; top: 0; left: 55%; background: var(--hot); color: #fff; font-size: 10px; border-radius: 9px; min-width: 17px; padding: 0 4px; text-align: center; line-height: 17px; }
  .mx td, .mx th { padding: 8px; }
  .mx { min-width: 600px; } .mx td.who { min-width: 150px; }
  .mbox { width: 100%; max-height: 88vh; }
  #modal { place-items: end center; padding: 0; } .mbox { border-radius: 16px 16px 0 0; }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .tl .e { grid-template-columns: 54px minmax(0, 1fr); }
  .tbl th:nth-child(4), .tbl td:nth-child(4) { display: none; }
  .search-m { display: block; }
  .search-m .field { width: 100%; }
}
@media (min-width: 861px) { .r-acts { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
