/* Кабинет команды SIL STEP. Цвета — как на silstep.ru: жёлтый только фоном и акцентом. */
:root {
  --yellow: #ffd21f;
  --yellow-deep: #f5b800;
  --yellow-soft: #fff6cc;
  --ink: #1b2130;
  --slate: #2b3242;
  --muted: #566074;
  --bg: #f5f6f9;
  --card: #fff;
  --line: #e2e5ec;
  --green: #1d7a4a;
  --green-soft: #e3f4ea;
  --red: #b42318;
  --red-soft: #fdeceb;
  --red-line: #f4b9b4;
  --amber: #8a5a00;
  --amber-soft: #fff3d6;
  --blue: #2350b8;
  --blue-soft: #e8eefc;
  --radius: 16px;
  --shadow: 0 12px 30px -20px rgb(27 33 48 / 0.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 40px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 700; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c5cad6; }
.btn.primary { background: var(--yellow); border-color: var(--yellow); }
.btn.primary:hover { background: var(--yellow-deep); border-color: var(--yellow-deep); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--red); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgb(27 33 48 / 0.06); }
.btn svg { width: 18px; height: 18px; flex: none; }

label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--slate); }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid #cfd4de; border-radius: 10px; background: #fff; font-weight: 400; font-size: 15px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--yellow); outline-offset: 0; border-color: var(--ink); }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.stack { display: grid; gap: 14px; }
.form-error { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 10px; font-weight: 600; }

/* ---------- Вход ---------- */
body.auth { background: var(--ink); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); background: var(--card); border-radius: 22px; padding: 32px; display: grid; gap: 18px; }
.auth-card h1 { font-size: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.12em; font-size: 15px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--yellow); display: inline-flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 7px; }
.logo i { width: 4px; background: var(--ink); border-radius: 1px; }
.logo i:nth-child(1) { height: 7px; } .logo i:nth-child(2) { height: 11px; } .logo i:nth-child(3) { height: 15px; }

/* ---------- Каркас ---------- */
.boot { padding: 40px; color: var(--muted); }
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--ink); color: #dfe3ec; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { color: #fff; padding: 4px 8px 8px; }
.nav { display: grid; gap: 2px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: #8d95a8; padding: 12px 10px 6px; }
.nav a, .nav button.navlink {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: #dfe3ec; text-decoration: none; font-weight: 500; background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
}
.nav a:hover, .nav button.navlink:hover { background: rgb(255 255 255 / 0.07); color: #fff; }
.nav a[aria-current="page"] { background: var(--yellow); color: var(--ink); font-weight: 700; }
.nav a[aria-current="page"] .count { background: var(--ink); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; }
.nav .soon { margin-left: auto; font-size: 11px; color: #8d95a8; }
.side-foot { margin-top: auto; border-top: 1px solid rgb(255 255 255 / 0.1); padding-top: 14px; display: grid; gap: 4px; }
.who { padding: 0 10px 8px; font-size: 13px; }
.who b { display: block; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.who span { color: #8d95a8; }

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; display: grid; gap: 22px; align-content: start; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- Сводка ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
  text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: grid; gap: 10px; cursor: pointer; position: relative;
}
.stat:hover { border-color: #c5cad6; box-shadow: var(--shadow); }
.stat[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.stat.static { cursor: default; box-shadow: none; }
.stat .label { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.stat .num { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stat .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.stat .ico svg { width: 18px; height: 18px; }
.tone-green .ico { background: var(--green-soft); color: var(--green); }
.tone-amber .ico { background: var(--amber-soft); color: var(--amber); }
.tone-red .ico { background: var(--red-soft); color: var(--red); }
.tone-red .num { color: var(--red); }
.tone-gray .ico { background: #eef0f4; color: var(--muted); }
.stat .sub { font-size: 12px; color: var(--muted); }

/* ---------- Фильтры ---------- */
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.filters.f4 { grid-template-columns: 2fr repeat(3, minmax(0, 1fr)); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: center;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.red { color: var(--red); border-color: var(--red-line); }
.chip.red[aria-pressed="true"] { background: var(--red); color: #fff; border-color: var(--red); }
.chip .n { opacity: 0.75; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #fafbfc; }
tr.alert td { background: var(--red-soft); }
tr.alert td:first-child { box-shadow: inset 4px 0 0 var(--red); }
tr.alert.clickable:hover td { background: #fbe1df; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 13px; color: var(--muted); }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 340px; }
.nowrap { white-space: nowrap; }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.reason { color: var(--red); font-weight: 700; font-size: 12px; margin-top: 4px; }
.late { color: var(--red); font-weight: 700; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-published, .b-done, .b-ok { background: var(--green-soft); color: var(--green); }
.b-planned, .b-open { background: var(--amber-soft); color: var(--amber); }
.b-missed, .b-overdue, .b-attention { background: var(--red-soft); color: var(--red); }
.b-sent, .b-doing { background: var(--blue-soft); color: var(--blue); }
.b-neutral { background: #eef0f4; color: var(--slate); }
.plat { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #eef0f4; font-size: 12px; font-weight: 700; }

.empty { padding: 48px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; color: var(--muted); }
.empty .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--yellow-soft); display: grid; place-items: center; color: var(--ink); }
.empty h3 { color: var(--ink); }

.mobile-list { display: none; }
.m-item { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; cursor: pointer; }
.m-item.alert { background: var(--red-soft); box-shadow: inset 4px 0 0 var(--red); }
.m-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Обзор ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.list { display: grid; }
.list-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); align-items: flex-start; text-decoration: none; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fafbfc; }
.list-item .grow { flex: 1; min-width: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot.ty-content { background: var(--yellow-deep); }
.dot.ty-thread { background: var(--blue); }
.dot.ty-task { background: var(--green); }
.dot.alert { background: var(--red); }
.day-label { padding: 10px 20px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--line); }

/* ---------- Задачи ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { background: #eceef3; border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; font-weight: 700; }
.task { background: #fff; border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); display: grid; gap: 8px; cursor: pointer; text-align: left; width: 100%; }
.task:hover { box-shadow: var(--shadow); }
.task.overdue { border-color: var(--red-line); box-shadow: inset 4px 0 0 var(--red); }
.task.high .t-title::before { content: "!"; color: var(--red); font-weight: 900; margin-right: 6px; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.t-title { font-weight: 600; }
.t-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }

/* ---------- Планировщик ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head h2 { min-width: 180px; text-transform: capitalize; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend .dot { margin: 0; }
.planner { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .dow { padding: 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--line); }
.cal .day {
  min-height: 108px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; background: #fff; text-align: left; border-top: 0; border-left: 0; cursor: pointer; overflow: hidden;
}
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: #fafbfc; color: #a0a7b6; }
.cal .day.today .d { background: var(--ink); color: #fff; }
.cal .day[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.cal .d { font-weight: 700; font-size: 13px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.ev { font-size: 12px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ev.ty-content { background: var(--yellow-soft); }
.ev.ty-thread { background: var(--blue-soft); color: var(--blue); }
.ev.ty-task { background: var(--green-soft); color: var(--green); }
.ev.alert { background: var(--red-soft); color: var(--red); font-weight: 700; }
.ev.done { opacity: 0.55; text-decoration: line-through; }
.more { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Команда, заготовки ---------- */
.people td { vertical-align: middle; }
.soon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.soon-card { padding: 18px 20px; display: grid; gap: 8px; }
.soon-card ul { margin: 0; padding-left: 18px; color: var(--muted); }
.notice { background: var(--yellow-soft); border-radius: 12px; padding: 12px 16px; display: flex; gap: 10px; align-items: flex-start; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: 13px; }

/* ---------- Окно редактирования ---------- */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5); color: var(--ink); }
dialog::backdrop { background: rgb(27 33 48 / 0.55); }
.dlg { display: grid; grid-template-rows: auto 1fr auto; max-height: calc(100vh - 24px); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); gap: 12px; }
.dlg-body { padding: 18px 22px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dlg-body .full { grid-column: 1 / -1; }
.dlg-foot { display: flex; gap: 8px; justify-content: space-between; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlg-foot .right { display: flex; gap: 8px; margin-left: auto; }
.dlg .meta { font-size: 12px; color: var(--muted); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); }

/* ---------- Телефон и планшет ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters, .filters.f4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planner { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-105%); transition: transform 0.2s; }
  .shell.menu-open .side { transform: none; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.45); }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 40; }
  .topbar .brand { color: #fff; }
  .topbar .btn { background: transparent; border-color: rgb(255 255 255 / 0.25); color: #fff; }
  .main { padding: 18px 14px 50px; }
  .table-wrap.responsive { display: none; }
  .mobile-list { display: block; }
  .board { grid-template-columns: 1fr; }
  .cal .day { min-height: 64px; padding: 4px; }
  .cal .ev { display: none; }
  .cal .more { display: none; }
  .cal .day.has::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); margin: 2px auto 0; }
  .cal .day.has.alert::after { background: var(--red); }
  .dlg-body { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .stat .num { font-size: 26px; }
  .filters, .filters.f4 { grid-template-columns: 1fr 1fr; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
.task .t-open { justify-content: flex-start; padding: 0; min-height: 0; text-align: left; white-space: normal; border: 0; }
.task .t-open:hover { background: none; text-decoration: underline; }
.t-meta .i, .t-meta svg { width: 14px; height: 14px; vertical-align: -2px; }
.main:focus { outline: none; }
.badge.cnt::before { display: none; }
.dlg-body { align-items: start; align-content: start; }

/* ---------- База вузов ---------- */
.sync-line { display: flex; gap: 6px; align-items: center; margin: -6px 0 14px; }
.sync-line svg { width: 16px; height: 16px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--ink); }
.back svg { width: 18px; height: 18px; }
.uni-badges { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: -6px 0 14px; }
.uni-toc { margin-bottom: 14px; }
.uni-toc .chip { text-decoration: none; }
.uni-secs { display: grid; gap: 14px; }
.uni-sec > summary { display: flex; align-items: center; gap: 10px; padding: 16px 20px; cursor: pointer; list-style: none; }
.uni-sec > summary::-webkit-details-marker { display: none; }
.uni-sec > summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.uni-sec[open] > summary::before { transform: rotate(45deg); }
.uni-sec > summary h2 { margin: 0; font-size: 1.05rem; }
.uni-sec > summary .n { background: var(--bg); border-radius: 999px; padding: 1px 9px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.uni-sec > .card-pad { padding-top: 0; }
.facts { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 0; margin: 0; }
.facts dt { font-weight: 600; color: var(--muted); font-size: .88rem; padding: 10px 14px 10px 0; border-top: 1px solid var(--line); }
.facts dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.facts dt:first-of-type, .facts dt:first-of-type + dd { border-top: 0; }
.rich { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.rich a { color: var(--blue); }
.block { display: block; }
.thread-item { width: 100%; text-align: left; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.thread-item.alert { background: var(--red-soft); }
.upload-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.runs { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; white-space: pre; }
@media (max-width: 860px) {
  .facts { grid-template-columns: 1fr; }
  .facts dt { padding-bottom: 2px; }
  .facts dd { border-top: 0; padding-top: 0; }
  .upload-row { grid-template-columns: 1fr; }
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* ---------- Почта ---------- */
.mail-item { width: 100%; text-align: left; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; align-items: flex-start; }
.mail-item.alert { background: var(--red-soft); }
.mail-item .dir { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; margin-top: 2px; }
.mail-item .dir.in { background: var(--blue-soft); color: var(--blue); }
.mail-item .dir.out { background: var(--green-soft); color: var(--green); }
.mail-top { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.mail-top .when { margin-left: auto; white-space: nowrap; }
.mail-subj { font-weight: 600; margin-top: 2px; }
.clamp1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
dialog.wide .dlg-body { grid-template-columns: minmax(0, 1fr); }
dialog.wide .rich { max-height: 55vh; overflow: auto; background: var(--bg); border-radius: 12px; padding: 14px 16px; }
.mail-files { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-files .chip { text-decoration: none; }
.mail-files svg { width: 16px; height: 16px; }
.link-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.link-row label { flex: 1 1 260px; }
.pager { display: flex; justify-content: space-between; }
.small-h { font-size: .9rem; margin: 6px 0 0; color: var(--muted); }

/* Шаблоны писем */
.tpl-grid { align-items: start; }
.tpl-preview { position: sticky; top: 16px; }
.tpl-form label, .tpl-preview label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.letter-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fbfbfc; }
.letter-box .mail-subj { margin: 0 0 10px; font-weight: 700; }
.letter { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .93rem; line-height: 1.55; }
@media (max-width: 900px) { .tpl-preview { position: static; } }
.tpl-list .list-item > svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--muted); }
.tpl-list .list-item { color: inherit; }

/* Выпуски недели */
.week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.week-day { padding: 14px; display: grid; gap: 10px; align-content: start; }
.week-day.tomorrow { box-shadow: 0 0 0 2px var(--amber); }
.week-day.today { box-shadow: 0 0 0 2px var(--blue); }
.week-day-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rel-item { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; background: #fff; }
.rel-item:hover { background: #fafbfc; }
.rel-item.rel-rework { border-color: var(--red); }
.rel-item.rel-approved { border-color: var(--green); }
.rel-time { font-size: .8rem; color: var(--muted); font-weight: 600; }
.rel-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rel-grid { grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); align-items: start; }
.rel-side { position: sticky; top: 16px; }
.plat-box { display: grid; gap: 6px; }
.plat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.hint.late { color: var(--red); font-weight: 600; }
.rel-history { margin: 0; padding-left: 18px; font-size: .86rem; display: grid; gap: 4px; }
@media (max-width: 900px) { .rel-grid { grid-template-columns: 1fr; } .rel-side { position: static; } }
.ed-box { border-top: 1px solid var(--line); padding-top: 12px; }
.ed-thread { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.ed-msg { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.ed-msg.agent { background: var(--blue-soft); border-color: transparent; }
.ed-msg.open { border-color: var(--amber); }
.ed-meta { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ed-body { white-space: pre-wrap; font-size: .9rem; margin-top: 4px; }
.rel-item.slot-carousel { background: #fffbea; }
.rel-side label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }

/* Аналитика: кратность к медиане */
td.num-cell.hit { color: var(--green, #1d7a3a); font-weight: 600; }
td.num-cell.low { color: var(--red); }
td.num-cell .cell-sub { display: block; }
