:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb; --accent: #1f4e79; --accent-2: #2f6aa3;
  --red: #b42318; --red-bg: #fdecea; --amber: #a15c07; --amber-bg: #fff4e0; --green: #1e7a3c; --green-bg: #e7f6ec; --blue-bg: #eaf1fa;
  --radius: 8px;
  /* фоны и рамки, которые тёмная тема переопределяет */
  --soft: #f8fafc; --soft-2: #eef1f5; --field: #fff; --field-line: #cdd2da; --line-2: #c5cbd3; --text-2: #374151; --accent-text: var(--accent);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
header { display: flex; align-items: center; gap: 16px; padding: 6px 20px; min-height: 52px; flex-wrap: wrap; background: var(--accent); color: #fff; position: sticky; top: 0; z-index: 5; }
header a { color: #fff; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
nav a { padding: 6px 10px; border-radius: 6px; opacity: .85; white-space: nowrap; }
nav a.on, nav a:hover { background: rgba(255,255,255,.15); opacity: 1; text-decoration: none; }
header .right { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
#who button { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header button.link { color: #fff; }
.timer { background: var(--card); color: var(--accent-text); border-radius: 12px; padding: 2px 10px; font-weight: 600; cursor: pointer; }
main { max-width: 1240px; margin: 0 auto; padding: 20px; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: none; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 6px 12px; border-radius: 6px; cursor: pointer; }
button:hover { border-color: var(--line-2); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { background: var(--accent-2); }
button.danger { color: var(--red); }
button.link { border: 0; background: none; padding: 0; color: var(--accent-2); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--field-line); border-radius: 6px; background: var(--field); color: var(--text); width: 100%; max-width: 100%; }
textarea { min-height: 70px; resize: vertical; }
textarea.grow-line { min-height: 0; resize: none; overflow: hidden; }
input[type=checkbox] { width: auto; }
label.f { display: block; margin-bottom: 10px; }
label.f > span, div.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
div.f { margin-bottom: 10px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.cols3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--soft-2); color: var(--text-2); white-space: nowrap; }
.b-red { background: var(--red-bg); color: var(--red); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-green { background: var(--green-bg); color: var(--green); }
.b-blue { background: var(--blue-bg); color: var(--accent-text); }
.b-grey { background: var(--soft-2); color: var(--muted); }
.warn { background: var(--amber-bg); color: var(--amber); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.err { background: var(--red-bg); color: var(--red); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.okmsg { background: var(--green-bg); color: var(--green); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 14px; color: var(--muted); }
.tabs button.on { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 4px 12px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.login { max-width: 380px; margin: 60px auto; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d2330; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 80vw; z-index: 20; }
#toast.on { opacity: 1; }
#toast.bad { background: var(--red); }
dialog { border: 0; border-radius: 10px; padding: 0; width: min(720px, 94vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15,23,42,.35); }
dialog form { padding: 18px 20px; max-height: 86vh; overflow: auto; }
.how { font-size: 12px; color: var(--muted); }
.quote { border-left: 3px solid var(--line); padding-left: 8px; color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 10px 0; }
.nowrap { white-space: nowrap; }
.stat { font-size: 26px; font-weight: 700; }
.stats { display: flex; gap: 24px; }
.stats > div { min-width: 110px; }
.c-red { color: var(--red); }
.c-amber { color: var(--amber); }
@media (max-width: 760px) { .cols2, .cols3 { grid-template-columns: 1fr; } header { gap: 10px; padding: 0 10px; } nav a { padding: 6px 6px; } .kv { grid-template-columns: 1fr; } }

.drop { border: 2px dashed #c5cbd3; border-radius: 10px; padding: 18px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.drop.over { border-color: var(--accent-2); background: var(--blue-bg); }
.doctext { white-space: pre-wrap; font-size: 12px; max-height: 60vh; overflow: auto; background: var(--soft); padding: 10px; border-radius: 6px; }
details summary { cursor: pointer; color: var(--accent-2); margin-top: 6px; }
a.btn { display: inline-block; text-decoration: none; }

.wl th, .wl td { text-align: center; }
.wl td:first-child, .wl th:first-child { text-align: left; }
.wl-cell { border-radius: 6px; min-width: 92px; }
.wl-pct { font-weight: 700; font-size: 15px; }
.wl-free { background: var(--green-bg); }
.wl-normal { background: var(--amber-bg); }
.wl-over { background: var(--red-bg); color: var(--red); }
.cal-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .36fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-wd { font-size: 12px; color: var(--muted); padding: 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--soft); }
.cal-day { min-height: 100px; padding: 4px 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; position: relative; cursor: pointer; }
.cal-day:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.cal-out { background: var(--soft); color: var(--muted); }
.cal-we { background: var(--soft); }
.cal-today .cal-num { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; display: inline-block; }
.cal-num { font-size: 12px; margin-bottom: 2px; }
.chip { font-size: 11px; line-height: 1.3; padding: 1px 5px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 1px solid transparent; }
.chip-hearing { background: var(--blue-bg); color: var(--accent-text); font-weight: 600; }
.chip-deadline { background: var(--amber-bg); color: var(--amber); }
.chip-task { background: var(--soft-2); color: var(--text-2); }
.chip-expected { background: var(--card); color: var(--muted); border-color: var(--line); }
.chip-absence { background: #f3effa; color: #5b3f8c; }
.chip-bad { background: var(--red-bg); color: var(--red); }
.chip-notask { border: 1px dashed var(--amber); }
/* календарь 0.57: плашки, полосы отсутствий, загрузка дня, панель дня, неделя по дням и по юристам */
:root { --violet: #5b3f8c; --violet-bg: #f3effa; --load-ok: #9cc9a9; --load-full: #e0a100; --load-over: #d92d20; }
.cal-ini { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 16px; padding: 0 3px; border-radius: 8px; font-size: 10px; font-weight: 600; color: #fff; flex: none; line-height: 1; }
.cal-ev { display: flex; align-items: center; gap: 4px; font-size: 11px; line-height: 1.3; padding: 1px 4px 1px 5px; margin-bottom: 2px; border-radius: 4px; border-left: 3px solid transparent; white-space: nowrap; overflow: hidden; cursor: pointer; }
.cal-t { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.cal-tm { font-weight: 700; }
.cal-h { background: var(--blue-bg); border-left-color: var(--accent-2); color: var(--accent-text); }
.cal-d { background: var(--amber-bg); border-left-color: var(--amber); color: var(--amber); }
.cal-notask { background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--card) 6px 9px); }
.cal-ev.cal-bad, .cal-hcard.cal-bad, .cal-dline.cal-bad { background-color: var(--red-bg); border-left-color: var(--red); color: var(--red); }
.cal-unchecked { outline: 1px dashed var(--amber); outline-offset: -1px; }
.cal-sum { display: flex; gap: 4px; flex-wrap: wrap; font-size: 11px; margin-top: 2px; }
.cal-pill { border-radius: 9px; padding: 0 6px; background: var(--soft-2); color: var(--text-2); white-space: nowrap; font-size: 11px; }
.cal-pill-bad { background: var(--red-bg); color: var(--red); }
.cal-pill-d { background: var(--amber-bg); color: var(--amber); }
.cal-pill-e { background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.cal-pill-h { background: var(--blue-bg); color: var(--accent-text); }
.cal-wecount { text-align: center; margin-top: 8px; }
.cal-bars { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .36fr)); padding-top: 2px; border-right: 1px solid var(--line); }
.cal-absbar { font-size: 11px; background: var(--violet-bg); color: var(--violet); border-radius: 4px; padding: 1px 6px; margin: 0 3px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 4px; align-items: center; min-width: 0; }
.cal-loadbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.cal-load-ok { background: var(--load-ok); } .cal-load-full { background: var(--load-full); } .cal-load-over { background: var(--load-over); }
.cal-pill.cal-load-ok { background: var(--green-bg); color: var(--green); } .cal-pill.cal-load-full { background: var(--amber-bg); color: var(--amber); } .cal-pill.cal-load-over { background: var(--red-bg); color: var(--red); }
.cal-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100%; background: var(--card); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.12); padding: 16px; overflow: auto; z-index: 50; }
.cal-h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 6px; }
.cal-item { padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; font-size: 13px; }
.cal-item-bad { border-color: var(--red); background: var(--red-bg); }
.cal-week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, .5fr); gap: 8px; margin-bottom: 8px; }
.cal-wbars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, .5fr); gap: 0 8px; margin-bottom: 6px; }
.cal-wbars .cal-absbar { margin: 0 0 3px; }
.cal-wcol { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 380px; min-width: 0; }
.cal-wtoday { border-color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--accent-2); }
.cal-wweekend { background: var(--soft); display: flex; flex-direction: column; }
.cal-whalf { flex: 1; padding: 6px 8px; min-width: 0; }
.cal-whalf + .cal-whalf { border-top: 1px solid var(--line); }
.cal-whead { display: flex; align-items: baseline; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cal-wnum { font-size: 18px; }
.cal-wsec { padding: 6px 8px; }
.cal-wsec + .cal-wsec { border-top: 1px dashed var(--line); }
.cal-wlabel { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.cal-hcard { border-left: 3px solid var(--accent-2); background: var(--blue-bg); border-radius: 6px; padding: 5px 7px; margin-bottom: 5px; font-size: 12px; }
.cal-hrow { display: flex; gap: 6px; align-items: center; white-space: nowrap; min-width: 0; }
.cal-hcard .cal-tm { color: var(--accent-text); font-size: 13px; } .cal-hcard.cal-bad .cal-tm { color: var(--red); }
.cal-dline { font-size: 12px; padding: 3px 6px; border-radius: 4px; background-color: var(--amber-bg); color: var(--amber); margin-bottom: 4px; border-left: 3px solid var(--amber); }
.cal-tline { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; padding: 3px 0; border-bottom: 1px solid var(--soft-2); }
.cal-box { width: 12px; height: 12px; border: 1.5px solid var(--line-2); border-radius: 3px; flex: none; margin-top: 2px; }
.cal-tbad .cal-box { border-color: var(--red); } .cal-tbad .cal-clamp { color: var(--red); }
.cal-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-lgrid { display: grid; grid-template-columns: 180px repeat(5, minmax(120px, 1fr)) minmax(48px, .4fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-lgrid > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 6px; min-width: 0; }
.cal-lhd { font-size: 12px; color: var(--muted); background: var(--soft); }
.cal-lhd-today { color: var(--accent-text); font-weight: 700; }
.cal-lwho .row { gap: 6px; flex-wrap: nowrap; }
.cal-lcell { min-height: 70px; position: relative; padding-bottom: 6px !important; }
.cal-ltoday { background: var(--blue-bg); }
.cal-off { background: repeating-linear-gradient(135deg, var(--violet-bg) 0 8px, var(--card) 8px 12px); color: var(--violet); }
@media (prefers-color-scheme: dark) { :root { --violet: #c4b0f0; --violet-bg: #2c2440; --load-ok: #3f7a52; } }
@media (max-width: 900px) { .cal-week, .cal-wbars { grid-template-columns: 1fr; } .cal-wbars .cal-absbar { grid-column: 1 !important; } .cal-wcol { min-height: 0; } .cal-drawer { width: 100%; } }
label.chip-hearing, label.chip-deadline, label.chip-task, label.chip-expected, label.chip-absence { padding: 2px 8px; border-radius: 12px; gap: 4px; font-weight: normal; }
.ag-day { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ag-date { font-weight: 600; }
.cal-today-t { color: var(--accent-text); }
.ag-item { padding: 2px 0; }
.click { cursor: pointer; }
@media (max-width: 760px) { .cal-day { min-height: 60px; } .chip { font-size: 10px; } .ag-day { grid-template-columns: 1fr; } }
.wl-off { background: var(--soft-2); color: var(--muted); }
.row > select, .row > div > select { width: auto; }

.bar { position: relative; height: 18px; background: var(--soft-2); border-radius: 9px; overflow: hidden; font-size: 11px; }
.bar-in { height: 100%; }
.bar span { position: absolute; left: 8px; top: 1px; color: #1d2330; }
.bar-green { background: #b9e4c7; } .bar-amber { background: #f6d38f; } .bar-red { background: #f2a59d; }
.stats { flex-wrap: wrap; }

.party-card { border-bottom: 1px solid var(--line); padding: 10px 0; }
.party-card:last-of-type { border-bottom: 0; }
tr.grp td { background: var(--soft); font-weight: 600; padding-top: 10px; }
table.cases td { font-size: 13px; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent-text); }
table.cases td { font-size: 13px; vertical-align: top; }
table.cases td .muted { font-size: 12px; }
main { max-width: 1480px; }

/* список дел: слева плотнее (короткие сведения), справа шире (сроки, задачи, события) */
table.cases th, table.cases td { padding: 6px 6px; }
table.cases .cn { min-width: 105px; max-width: 150px; font-size: 12px; line-height: 1.35; overflow-wrap: normal; word-break: normal; hyphens: manual; }
table.cases .cs { min-width: 78px; max-width: 105px; }
table.cases th.cn { font-size: 11px; }
table.cases .cw { min-width: 210px; }
table.cases .csubj { min-width: 260px; max-width: 380px; }
table.cases .camt { min-width: 110px; text-align: right; white-space: nowrap; }
table.cases td.cn .muted { font-size: 11px; }
main.wide { max-width: none; }

.person-line { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) 1.2fr; gap: 12px; align-items: start; flex: 1; }
.person-row { border-bottom: 1px solid var(--line); padding: 8px 0; align-items: flex-start; }
.proj-block { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
@media (max-width: 760px) { .person-line { grid-template-columns: 1fr; } }
/* команда и поручения */
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 4px; }
.checklist .row { gap: 6px; margin-bottom: 4px; }
.comments { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.comments h3 { font-size: 14px; margin: 0 0 6px; }
.comments .cm { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.comments .cm.return > div { color: var(--red, #b42318); }
.comments .row textarea { flex: 1; }
th.num, td.num { text-align: right; white-space: nowrap; }
.checks.col { flex-direction: column; gap: 3px; }
.scroll-x { overflow-x: auto; }
table.matrix th.small { font-weight: 600; min-width: 110px; vertical-align: bottom; }
table.matrix td.center, table.matrix th { text-align: center; }
table.matrix td:first-child { text-align: left; }
.center { text-align: center; }
/* отчёты и печать */
.print-title { display: none; }
.doc h3 { margin: 18px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.doc h4 { margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.doc .rep-case:first-of-type h3 { border-top: 0; }
@media print {
  header#top, #toast, .noprint, .tabs { display: none !important; }
  .print-title { display: block; }
  body { background: var(--card); }
  main, #main.wide { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 6px 0; break-inside: avoid; }
  .rep-case { break-inside: avoid-page; }
  a { color: inherit; text-decoration: none; }
  .click { cursor: auto; }
}
.row.period { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.row.period input, .row.period select { width: auto; margin: 0; }
/* окно поверх окна: уже основного, затемнение сильнее — видно, что под ним осталось незакрытое окно */
dialog.dlg-over { width: min(520px, 92vw); }
dialog.dlg-over::backdrop { background: rgba(0, 0, 0, .35); }
details.digest > summary { cursor: pointer; list-style: revert; }
details.digest h3 { margin: 14px 0 6px; font-size: 14px; }
.tpl-pick { background: var(--bg, #f6f7f9); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
.update-bar { position: sticky; top: 0; z-index: 50; margin: 0; border-radius: 0; text-align: center; }
/* задачи */
.tsum { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.tchip { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); cursor: pointer; }
.tchip .n { font-weight: 700; font-size: 17px; }
.tchip.red .n { color: var(--red, #b42318); } .tchip.amber .n { color: var(--amber); } .tchip.blue .n { color: var(--accent-text); }
.tchip.zero { opacity: .55; } .tchip.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.tbar { gap: 8px; flex-wrap: wrap; margin-bottom: 10px; } .tbar .grow { flex: 1; min-width: 220px; } .tbar input, .tbar select { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--card); padding: 6px 12px; }
.seg button.on { background: var(--accent); color: #fff; }
.tl-group { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.tl-ghead { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--soft); border-bottom: 1px solid var(--line); }
.tl-count { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--soft-2); border-radius: 10px; padding: 1px 8px; }
.g-overdue .tl-ghead { background: var(--red-bg); } .g-today .tl-ghead { background: var(--amber-bg); }
.tl-row { display: grid; grid-template-columns: 130px 1fr 40px 150px; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; cursor: pointer; }
.tl-row:last-child { border-bottom: 0; } .tl-row:hover { background: var(--soft); }
.tl-row.h-overdue { border-left-color: #f04438; } .tl-row.h-today { border-left-color: #f79009; } .tl-row.court { background-image: linear-gradient(90deg, rgba(37,99,235,.05), transparent 30%); }
.tl-row.h-closed { opacity: .65; }
.tl-date { font-weight: 600; } .tl-title { font-weight: 500; }
/* поручение суда в «Что сделать» — дословно из определения, бывает длинным: в списках — до 3 строк, целиком — в карточке и при наведении */
.tl-title, .tb-title, .clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
 .tl-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 3px; }
.tl-progress { height: 4px; background: var(--soft-2); border-radius: 2px; margin-top: 6px; max-width: 220px; } .tl-progress span { display: block; height: 100%; background: #12b76a; border-radius: 2px; }
.avatar { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.c-amber { color: var(--amber); } .c-green { color: #067647; }
.tboard { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.tb-col { background: var(--soft); border-radius: 10px; padding-bottom: 8px; min-height: 160px; } .tb-col .tl-ghead { background: transparent; border: 0; }
.tb-col.over { outline: 2px dashed var(--accent); }
.tb-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid transparent; border-radius: 8px; margin: 0 8px 8px; padding: 8px 10px; cursor: grab; }
.tb-card.h-overdue { border-left-color: #f04438; } .tb-card.h-today { border-left-color: #f79009; } .tb-card.dragging { opacity: .4; }
.tb-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; } .tb-title { font-weight: 500; margin-bottom: 4px; }
.tb-empty { padding: 8px 14px; }
.empty-state { text-align: center; padding: 30px; } .empty-state .big { font-size: 17px; font-weight: 600; margin-bottom: 6px; } .empty-state .row { justify-content: center; }
@media (max-width: 760px) { .tl-row { grid-template-columns: 90px 1fr; } .tl-who, .tl-status { display: none; } .tboard { grid-template-columns: repeat(4, 240px); } }
.task-case { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-left: 4px solid var(--accent, #2b5797); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.task-case .grow { flex: 1; min-width: 0; }
.task-hearing { margin-top: 4px; font-size: 14px; }
.task-hearing.moved b { color: var(--amber, #a15c00); }
.court-box { border: 1px solid #c7d7fe; background: var(--blue-bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.court-box .row { gap: 8px; align-items: center; } .court-quote { margin: 8px 0; font-size: 13px; color: var(--text-2); border-left-color: #84adff; }
.court-dates { display: flex; gap: 24px; margin: 6px 0; flex-wrap: wrap; } .court-dates .grow { flex: 1; min-width: 200px; }
.filing-box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0 12px; }
.filing-box .row { gap: 8px; align-items: center; }
.filing-box label.row { flex-wrap: nowrap; align-items: flex-start; gap: 6px; } .filing-box label.row input { width: auto; margin-top: 3px; flex: none; }
.pkg-items .pkg-item { gap: 6px; margin-bottom: 6px; align-items: center; } .pkg-items select { flex: 1; margin: 0; } .pkg-items input { margin: 0; }
details.tl-group > summary { cursor: pointer; list-style: revert; }
/* трек дела */
.stepper { display: flex; gap: 4px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.step { flex: 1; min-width: 110px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; position: relative; padding-top: 2px; }
.step:not(:last-child)::after { content: ''; position: absolute; top: 14px; left: calc(50% + 16px); right: calc(-50% + 16px); height: 2px; background: #d0d5dd; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--soft-2); color: #667085; z-index: 1; }
.step .lbl { font-size: 12px; line-height: 1.25; }
.st-done .dot { background: #d1fadf; color: #067647; } .st-done::after { background: #6ce9a6 !important; }
.st-cur .dot { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.18); } .st-cur .lbl { font-weight: 700; }
.st-next .dot { background: var(--card); border: 2px solid var(--accent); color: var(--accent-text); }
.st-skip .dot { background: var(--card); border: 1px dashed #d0d5dd; } .st-skip .lbl, .st-fut .lbl { color: var(--muted); }
.st-plan .dot { border: 2px dashed var(--accent); } .st-plan .small { color: var(--accent-text); }
.tr-branch { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--soft-2); border-radius: 4px; }
.tr-branch .br-head { flex: 0 1 230px; display: flex; flex-direction: column; gap: 2px; }
.tr-branch .grow { flex: 1 1 380px; min-width: 0; }
.stepper.mini { margin-top: 0; }
.stepper.mini .step { min-width: 90px; }
.stepper.mini .dot { width: 20px; height: 20px; font-size: 11px; }
.stepper.mini .step:not(:last-child)::after { top: 11px; left: calc(50% + 13px); right: calc(-50% + 13px); }
.tr-branch .br-dl { margin-top: 4px; }
.tr-stage.now { border-top: 3px solid var(--accent); } .tr-stage.next { border-top: 3px dashed #84adff; }
.tr-stage h3 { font-size: 14px; margin: 14px 0 6px; }
/* центр компетенций (competence.js) */
.cp-stages { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; }
.cp-st { padding: 3px 9px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 12px; cursor: pointer; }
.cp-st.rec { border-color: var(--accent-2); background: var(--blue-bg); }
.cp-st.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.cp-fork { margin: 12px 0 4px; font-size: 12px; font-weight: 600; color: var(--amber); }
.cp-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.cp-card { border: 1px solid var(--line); border-left: 4px solid #9aa4b2; border-radius: 6px; padding: 8px 10px; background: var(--card); }
.cp-card summary { cursor: pointer; list-style: none; } .cp-card summary::-webkit-details-marker { display: none; }
.cp-card.k-p { border-left-color: var(--accent-2); } .cp-card.k-d { border-left-color: #7c3aed; } .cp-card.k-q { border-left-color: var(--amber); }
.cp-card.k-re { border-left-color: var(--red); } .cp-card.k-or { border-left-color: var(--green); } .cp-card.k-pk { border-left-color: #be185d; }
.cp-card.k-am { border-left-color: #ca8a04; } .cp-card.k-tl { border-left-color: #0e7490; }
.cp-items { margin-top: 6px; }
.cp-item { display: block; padding: 3px 0; font-size: 13px; border-top: 1px solid var(--line); }
label.cp-item { cursor: pointer; } .cp-item.done { color: var(--muted); }
.cp-bar { display: inline-flex; align-items: center; gap: 6px; } .cp-bar::before { content: ''; }
.cp-bar { position: relative; min-width: 120px; height: 16px; background: var(--soft-2); border-radius: 8px; overflow: hidden; vertical-align: middle; }
.cp-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #b7dfc4; }
.cp-n { position: relative; font-size: 11px; padding: 0 8px; }
.cp-kb { padding: 8px 0; border-top: 1px solid var(--line); }
button.link.b { font-weight: 600; }
.tr-act { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); } .tr-act .grow { flex: 1; } .tr-act button { white-space: nowrap; }
/* уведомления */
.bell { background: none; border: 0; color: #fff; font-size: 17px; position: relative; padding: 4px 8px; cursor: pointer; }
.bell #bellN:not(:empty) { position: absolute; top: -2px; right: -4px; background: #f79009; color: #fff; border-radius: 9px; font-size: 11px; padding: 0 5px; font-weight: 700; }
.bell.red #bellN:not(:empty) { background: #f04438; }
.notif-panel { position: fixed; top: 54px; right: 12px; width: min(420px, 94vw); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 60; }
.np-head { padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.np-item { padding: 9px 14px; border-bottom: 1px solid var(--line); cursor: pointer; } .np-item:hover { background: var(--soft); }
.np-item.unread { background: var(--blue-bg); border-left: 3px solid var(--accent); } .np-item.unread.red { border-left-color: #f04438; } .np-item.unread.amber { border-left-color: #f79009; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; }
.spec-grid label { display: flex; align-items: center; justify-content: space-between; gap: 6px; } .spec-grid select { width: 110px; margin: 0; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.sugg { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; } .sugg-item { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.sugg-item.best { border-color: #6ce9a6; background: var(--green-bg); } .sugg-item.blocked { opacity: .6; } .sugg-item:hover { border-color: var(--accent); }
.imp-table { max-height: 50vh; overflow: auto; margin-top: 8px; } .imp-table table { font-size: 12px; }
.imp-skip td { opacity: .6; } .imp-error { background: var(--red-bg); }
dialog:has(.imp-table) { width: min(1100px, 96vw); }
/* CRM */
.crm-board { overflow-x: auto; } .crm-board .tb-col { min-width: 200px; }
.funnel-row { display: grid; grid-template-columns: 190px 1fr 40px; gap: 8px; align-items: center; margin: 4px 0; }
.funnel-bar { height: 10px; background: var(--soft-2); border-radius: 5px; overflow: hidden; } .funnel-bar span { display: block; height: 100%; background: var(--accent); }
.touch { padding: 7px 0; border-bottom: 1px dashed var(--line); } .touch.in { border-left: 3px solid #12b76a; padding-left: 8px; } .touch.out { border-left: 3px solid var(--accent); padding-left: 8px; }
.touch-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; } .touch-form .row select { width: auto; margin: 0; }
.next-card.overdue { border-top: 3px solid #f04438; }
.opp-list .opp { gap: 6px; margin-bottom: 6px; } .opp-list input { margin: 0; }
.step.click { cursor: pointer; } .step.click:hover .dot { box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
/* клиенты: отборы и направления */
.cl-filters { margin: 10px 0 6px; }
.cl-filters select { width: auto; margin: 0; max-width: 260px; }
.cl-filters select.on { border-color: var(--accent); background: var(--blue-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 3px; }
.chips .badge { white-space: nowrap; }
/* расчёты */
.calc-grid { grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.3fr); align-items: start; }
.calc-total { font-size: 26px; font-weight: 700; margin: 4px 0 8px; }
.calc-table td, .calc-table th { font-size: 13px; }
.pay-row input { width: auto; margin: 0 0 4px; }
@media (max-width: 800px) { .calc-grid { grid-template-columns: 1fr; } }
@media print { .calc-print .calc-total { font-size: 18px; } .calc-print .warn { background: none; } }
/* мониторинг Чекко */
.mon-ev .mon-text { margin: 6px 0 4px; font-weight: 600; }
.mon-ev.done { opacity: .65; }
.mon-advice { margin-top: 6px; padding: 6px 10px; background: var(--blue-bg); border-radius: 6px; }

/* ===================== телефон и приложение (PWA) ===================== */
.m-only, .tabbar { display: none; }
.hbtn { background: none; border: 0; color: #fff; font-size: 22px; line-height: 1; padding: 4px 8px; cursor: pointer; }
/* вход без пароля в режиме проверки */
.dev-login { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.dev-login p { width: 100%; margin: 0; }
/* составить документ */
.compose-fields .empty-val { border-color: var(--amber); background: var(--amber-bg); }
/* корзина */
/* безопасный вход: QR-коды, резервные коды, журнал, PIN */
.qr-box { text-align: center; margin: 8px 0; }
img.qr { width: 200px; height: 200px; image-rendering: pixelated; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
code.secret { word-break: break-all; user-select: all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 10px 0; font-size: 16px; }
.codes code { padding: 6px 8px; background: var(--bg); border-radius: 4px; text-align: center; user-select: all; }
ol.steps { padding-left: 20px; } ol.steps li { margin-bottom: 4px; }
tr.sec-bad td { color: var(--red); }
.sess-row .trash-main { flex: 1; min-width: 0; }
.connect-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.connect-row code { word-break: break-all; }
dialog.pin-lock { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; padding: 0; background: var(--bg); }
dialog.pin-lock::backdrop { background: var(--bg); }
.pin-form { max-width: 320px; margin: 18vh auto 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.pin-form .pin-input { font-size: 24px; letter-spacing: 8px; text-align: center; }
body.locked #main, body.locked #top, body.locked #tabbar, body.locked #notifPanel { visibility: hidden; }
.trash-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.trash-row:last-child { border-bottom: 0; }
.trash-main { min-width: 0; overflow-wrap: anywhere; }
.warn-text { color: var(--amber, #b26b00); }
/* инстанции дела */
.inst-box { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.inst-box h3 { margin: 0; font-size: 14px; }
.inst-row { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.inst-row.cur { font-weight: 500; }
.inst-row.cur b::before { content: '▸ '; color: var(--accent-text); }
/* поиск */
#searchBtn { font-size: 24px; }
dialog.search-dlg { align-self: flex-start; margin-top: 6vh; }
.search-q { width: 100%; font-size: 17px; padding: 10px 12px; margin-bottom: 12px; }
.search-res .md-sec { margin-bottom: 14px; }
/* работа без связи: полоса, очередь неотправленного */
.offbar { background: var(--amber-bg); color: var(--amber); padding: 8px 16px; font-size: 13px; border-bottom: 1px solid #f0d9b0; }
.outbox-btn { background: var(--amber-bg); color: var(--amber); border: 0; border-radius: 12px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.outbox-btn.red { background: var(--red-bg); color: var(--red); }
.kad-chip { background: rgba(255,255,255,.16); color: #fff; border-radius: 12px; padding: 3px 10px; font-size: 12px; white-space: nowrap; text-decoration: none; }
.kad-prog:not(:empty) { margin: 6px 0 10px; }
.outbox-text { width: 100%; font-size: 13px; margin-top: 6px; }
.md-stamp.off { color: var(--amber); font-weight: 600; }
/* фото документа */
.ph-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 10px 0; }
.ph-page { position: relative; border: 1px solid var(--line, #dde3ea); border-radius: 6px; overflow: hidden; background: var(--soft); aspect-ratio: 3 / 4; }
.ph-page img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-n { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; border-radius: 8px; padding: 0 6px; }
.ph-del { position: absolute; right: 2px; top: 2px; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 50%; width: 28px; height: 28px; min-height: 0; padding: 0; font-size: 14px; }
/* «Мой день» */
.md-head { align-items: baseline; }
.md-head h1 { margin-bottom: 6px; }
.md-date { font-size: 13px; }
.md-sec { margin: 0 0 18px; }
.md-sec > h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 8px; }
.md-n { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--soft-2); border-radius: 10px; padding: 0 8px; }
.md-sec.red > h2 { color: var(--red); } .md-sec.red .md-n { background: var(--red-bg); color: var(--red); }
.md-day { font-size: 13px; color: var(--muted); margin: 10px 0 6px; text-transform: none; }
.md-item { background: var(--card); border: 1px solid var(--line); border-left: 4px solid transparent; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.md-item.red { border-left-color: #f04438; } .md-item.amber { border-left-color: #f79009; }
.md-item:hover { background: var(--soft); }
.md-row { display: flex; gap: 8px; align-items: flex-start; }
.md-row > b { min-width: 0; overflow-wrap: anywhere; }
.md-foot { margin: 8px 0 4px; }
.hcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; display: grid; gap: 4px; }
.hcard.today { border-color: #84adff; box-shadow: inset 4px 0 0 var(--accent); }
.hcard.bad { box-shadow: inset 4px 0 0 #f04438; }
.hc-top { display: flex; align-items: baseline; gap: 10px; }
.hc-time { font-size: 22px; font-weight: 700; color: var(--accent-text); line-height: 1.1; }
.hc-when { flex: 1; }
.hc-court { font-weight: 600; }
.hc-case { color: var(--text); overflow-wrap: anywhere; }
.hc-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hc-acts .btn, .hc-acts button { padding: 7px 12px; }
.install-hint { display: grid; gap: 8px; border-color: #c7d7fe; background: var(--blue-bg); }
.install-hint button.primary { justify-self: start; }
/* дела карточками (телефон) */
.ccards { display: grid; gap: 8px; }
.ccard { display: grid; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); }
.ccard:hover { text-decoration: none; background: var(--soft); }
.cc-title { overflow-wrap: anywhere; }
.cc-badges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cc-subj { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-group { margin: 12px 0 2px; font-size: 13px; }
/* «Ещё» и «Добавить» */
.sheet-list { display: grid; gap: 6px; margin-bottom: 10px; }
.sheet-item { text-align: left; padding: 12px 14px; font-size: 15px; }
.sheet-item.danger { color: var(--red); }
.sheet-list.two { grid-template-columns: 1fr 1fr; }
.sheet-list.two .sheet-item { padding: 11px 12px; font-size: 14px; }

@media (max-width: 760px) {
  .m-only { display: initial; }
  .d-only, #nav { display: none !important; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); -webkit-text-size-adjust: 100%; }
  header { padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top)); min-height: 48px; flex-wrap: nowrap; gap: 8px; }
  header .right { gap: 6px; margin-left: auto; }
  .timer { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
  main, main.wide { padding: 12px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  h1 { font-size: 20px; }
  .card { padding: 12px; overflow-x: auto; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .stats { gap: 14px; } .stats > div { min-width: 90px; }
  /* поля: 16px — иначе iPhone увеличивает страницу при вводе; кнопки — под палец */
  input, select, textarea { font-size: 16px; padding: 9px 10px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  button, .btn { min-height: 40px; padding: 8px 14px; }
  button.link, .bell, .hbtn, .tabs button, .seg button { min-height: 0; }
  .row > select, .row > div > select { width: 100%; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs button { white-space: nowrap; padding: 10px 12px; }
  th, td { padding: 8px 6px; }
  /* нижнее меню */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
  .tabbar[hidden] { display: none; }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 56px; min-height: 0; padding: 0; border: 0; border-radius: 0;
    background: none; color: var(--muted); font-size: 11px; text-decoration: none; }
  .tab:hover { text-decoration: none; }
  .tab .ico { width: 24px; height: 24px; }
  .tab.on { color: var(--accent-text); font-weight: 600; }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); max-width: 92vw; }
  .notif-panel { top: calc(52px + env(safe-area-inset-top)); left: 8px; right: 8px; width: auto; max-height: calc(100dvh - 140px); }
  /* окна — на весь экран, кнопки внизу всегда видны */
  dialog, dialog.dlg-over { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  dialog form { height: 100%; max-height: none; display: flex; flex-direction: column; padding: 14px 14px 0;
    padding-top: calc(14px + env(safe-area-inset-top)); }
  dialog form > .row.end:last-child { position: sticky; bottom: 0; margin: auto -14px 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--line); z-index: 2; }
  dialog form > .row.end:last-child .primary { flex: 1; }
  dialog.search-dlg { margin: 0; }
  .outbox-btn { font-size: 11px; padding: 3px 8px; }
  dialog.sheet { height: auto; max-height: 88dvh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
  dialog.sheet form { height: auto; max-height: 88dvh; padding-top: 16px; }
  /* «Мой день» */
  .md-head .seg { margin-left: auto; }
  .hc-acts .btn, .hc-acts button { flex: 1 1 auto; text-align: center; }
  .tsum { gap: 6px; } .tchip { padding: 5px 10px; font-size: 13px; }
  .tl-row { padding: 10px 12px; }
  .tl-main { min-width: 0; overflow-wrap: anywhere; }
  .tl-meta .badge, .md-item .badge, .ccard .badge { white-space: normal; }
  .cfilters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .cfilters > :first-child { grid-column: 1 / -1; min-width: 0 !important; }
}
/* установленное приложение: шапка под строкой состояния iPhone */
@media (display-mode: standalone) {
  header { padding-top: calc(6px + env(safe-area-inset-top)); }
}

/* карточка проекта: реестр дел, статистика, график */
/* верх карточки проекта — плотно: без заголовков-пустот, график и поступления рядом */
.pt-top { margin-bottom: 16px; }
.pt-top > .card { margin-bottom: 0; }
.pt-head { padding: 12px 16px; }
.pt-head .kv { grid-template-columns: max-content 1fr; gap: 6px 16px; }
.pt-head h2 { margin-bottom: 6px; }
.pt-head h3 { margin: 6px 0 2px; }
.pt-payhead { gap: 8px; align-items: baseline; }
.pt-paytbl td { padding-top: 2px; padding-bottom: 2px; }
.pt-more { margin-top: 8px; }
.pt-more .kv { margin-top: 6px; }
@media (max-width: 760px) { .pt-head .kv { grid-template-columns: 1fr; gap: 2px; } }
.pt-filters { gap: 6px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.pt-filters select { width: auto; max-width: 230px; margin: 0; }
.pt-filters select.pt-fon { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, var(--field)); }
.pt-filters .pt-fq { flex: 1; min-width: 200px; } .pt-filters .pt-fq input { margin: 0; }
td.pt-no, th.pt-no { width: 1%; white-space: nowrap; text-align: right; color: var(--muted); }
td.cid { white-space: nowrap; color: var(--muted); }
.pt-stats { margin-bottom: 12px; row-gap: 12px; }
.pt-stats .stat, .pt-pay .stat { font-size: 20px; }
.pt-pay { margin-bottom: 8px; row-gap: 8px; }
table.pt td.pt-cell { cursor: text; }
table.pt td.pt-cell:hover { background: var(--blue-bg); }
table.pt .pt-edit, table.pt .pt-edit-h { width: 24px; padding-right: 0; }
table.pt tr.pt-total td { font-weight: 700; border-top: 2px solid var(--line); background: var(--soft); }
.pt-chart { width: 100%; max-height: 240px; display: block; }
.pt-chart .pt-grid { stroke: var(--line); stroke-width: 1; }
.pt-chart .pt-ax { font-size: 10px; fill: var(--muted); }
.pt-chart .pt-bar { fill: #c9d8ec; }
.pt-chart .pt-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.pt-chart .pt-line2 { fill: none; stroke: #067647; stroke-width: 2; stroke-dasharray: 5 3; }
.pt-legend { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pt-k { display: inline-block; width: 14px; height: 4px; margin: 0 4px 0 10px; vertical-align: middle; }
.pt-k-bar { height: 10px; background: #c9d8ec; } .pt-k-line { background: var(--accent); } .pt-k-line2 { background: #067647; }
.pt-order { border: 1px solid var(--line); border-radius: 6px; max-height: 260px; overflow: auto; }
.pt-ord-row { display: flex; gap: 6px; align-items: center; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.pt-ord-row:last-child { border-bottom: 0; }
.pt-ord-t { flex: 1; }
.pt-add { margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pt-add button { padding: 2px 8px; }
.pt-auto { font-style: italic; color: var(--text-2); }
.grp-t { cursor: pointer; user-select: none; }
tr.grp-t:hover td { background: var(--soft-2); }
.grp-arrow { display: inline-block; width: 1.1em; color: var(--muted); }

/* исполнительное производство */
.enf-card .kv { margin-top: 10px; }
.enf-old { opacity: .75; }
.enf-dl { margin-top: 10px; }
.enf-dl table, .enf-items { width: 100%; border-collapse: collapse; margin-top: 4px; }
.enf-dl td, .enf-items td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; }

/* КАД в карточке дела */
.kad-box { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.kad-box .row { gap: 8px; flex-wrap: wrap; }

/* потянуть вниз — обновить (live.js) */
.ptr { position: fixed; top: calc(56px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 20; background: var(--card);
  color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 6px 14px; font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,.12); pointer-events: none; }
@media (max-width: 760px) { html { overscroll-behavior-y: contain; } }

/* ---- тёмная тема — по настройке телефона или компьютера (ТЗ «Мобильная версия», 4.3) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --card: #1a1f26; --text: #e6e9ee; --muted: #9aa4b2; --line: #2d3540; --accent: #1f4e79; --accent-2: #8bbcf0;
    --red: #ff8a80; --red-bg: #3a1f20; --amber: #f5b85c; --amber-bg: #3a2e17; --green: #74d69a; --green-bg: #173021; --blue-bg: #1b2a3d;
    --soft: #20262e; --soft-2: #29313b; --field: #12161b; --field-line: #3a4350; --line-2: #4a5462; --text-2: #c9cfd8; --accent-text: #8bbcf0;
    color-scheme: dark;
  }
  .b-red { background: var(--red-bg); color: var(--red); } .b-amber { background: var(--amber-bg); color: var(--amber); }
  .b-green { background: var(--green-bg); color: var(--green); } .b-blue { background: var(--blue-bg); color: var(--accent-2); }
  .timer { background: #e6e9ee; color: var(--accent); }
  .bar span { color: #111418; }
  dialog { background: var(--card); color: var(--text); }
  img.qr { background: #fff; }   /* QR-код читается только на светлом */
  .doc, .rep-case { color: var(--text); }
  .c-green { color: var(--green); }
  #toast { background: #e6e9ee; color: #111418; }
}
/* печать — всегда светлая, даже при тёмной теме */
@media print {
  :root { --bg: #fff; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb; --accent-2: #2f6aa3; --soft: #f8fafc; --soft-2: #eef1f5;
    --field: #fff; --field-line: #cdd2da; --text-2: #374151; --red-bg: #fdecea; --amber-bg: #fff4e0; --green-bg: #e7f6ec; --blue-bg: #eaf1fa; color-scheme: light; }
}

/* карточка дела: стороны вверху, ход дела по инстанциям */
.case-facts { margin-bottom: 12px; font-size: 14px; }
.case-alerts > div { margin: 0 0 8px; }
/* «Сведения» дела сеткой по ширине: название над значением */
.kvg { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(220px, 22%), 1fr)); gap: 12px 24px; }
.kvg-i { min-width: 0; overflow-wrap: anywhere; }
.kvg-l { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
/* документ, внёсший непроверенное: отметка слева; прокрутка к нему не прячется под шапку */
.doc-unchecked { border-left: 4px solid var(--amber); }
.doc-unchecked, .tabs, .card { scroll-margin-top: 70px; }
.card-h { margin: 0 0 8px; font-size: 15px; }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; }
.cp-h { text-transform: none; margin-bottom: 4px; }
.cp-person { border-top: 1px solid var(--line); padding: 6px 0 8px; }
.cp-person.ours b { color: var(--accent-text); }
.cp-badges { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.course-inst { padding: 6px 0; border-top: 1px solid var(--line); }
.course-inst:first-of-type { border-top: 0; }
.cs-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 4px; font-size: 13px; }
.cs-step { background: var(--soft-2); border-radius: 6px; padding: 2px 8px; }
.cs-step.res { background: var(--green-bg); color: var(--green); }
.cs-step.next { outline: 1px solid var(--accent-text); }
.cs-arrow { color: var(--muted); }
.case-note { margin-top: 10px; }

/* карточка дела: «Что сделано» */
.work-form { margin-top: 8px; }
.work-form textarea { width: 100%; }
.work-form-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.work-form-row input[name=date] { width: 150px; }
.work-form-row input[name=hours] { width: 80px; }
.work-list { margin-top: 10px; border-top: 1px solid var(--line, #e5e7eb); }
.work-line { display: grid; grid-template-columns: 90px 1fr auto auto; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line, #e5e7eb); }
.work-text { white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 640px) { .work-line { grid-template-columns: 1fr auto; } .work-text { grid-column: 1 / -1; grid-row: 2; } .work-line > button { grid-column: 1 / -1; justify-self: start; } .work-line > span:empty { display: none; } }
.tr-line { display: flex; gap: 8px; align-items: flex-start; margin: 5px 0; font-weight: normal; }
.tr-line input { width: auto; margin-top: 3px; flex: none; }

/* команда проекта */
.pt-block { margin: 12px 0; }
.pt-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
/* календарь на телефоне: фильтры под «Фильтры», в месяце без инициалов юриста — места хватает на время и номер дела */
.cal-filters > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.cal-filters > .row { margin-top: 6px; }
@media (max-width: 760px) { .cal-day .cal-ini { display: none; } }

/* быстрые действия в окне задачи */
.task-quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; margin-bottom: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; }
.task-quick .task-move { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-quick .task-move input[type=date] { width: auto; }
.task-quick > .small { flex-basis: 100%; }
