/* Фирменный стиль ITHOUSE (skill ithouse-design, раздел 10). Токены канона, без легаси. */
:root {
  --ink: #262626; --red: #C22736; --red-d: #9E1A2F; --red-soft: #E86672; --red-tint: #FFD3D3;
  --gray: #6E6E6E; --lgray: #BDBDBD; --soft: #F5F5F5; --line: #E5E5E5; --bg: #FFFFFF; --panel: #FFFFFF;
  --side: #262626; --side-ink: #F5F5F5; --side-mute: #BDBDBD; --side-hover: #303030;
  --r-btn: 999px; --r-card: 30px; --r-sm: 10px;
  --font: 'DM Sans', 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 17px; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.muted { color: var(--gray); }
.small { font-size: 13px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }

/* Каркас: боковое меню + контент */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
/* Меню прилипает к экрану: профиль и уведомления внизу видны на любой длине страницы */
.side { background: var(--side); color: var(--side-ink); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { width: 150px; height: auto; color: var(--side-ink); margin-left: 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .grp { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--side-mute); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--side-ink); font-size: 14px; }
.nav a:hover { background: var(--side-hover); }
.nav a[aria-current="page"] { background: var(--side-hover); font-weight: 700; }
.nav a[aria-current="page"]::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--red-soft); flex: none; }
.side .who { margin-top: auto; font-size: 12px; color: var(--side-mute); padding: 0 10px; }
.side .who b { display: block; color: var(--side-ink); font-size: 13px; }
.side .who a { text-decoration: none; color: inherit; }
.side .who .bell { display: flex; align-items: center; gap: 8px; color: var(--side-ink); font-size: 13px; margin-bottom: 10px; }
.side .who .bell .cnt { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: var(--r-btn); padding: 1px 7px; }
.rv.unread { border-left: 3px solid var(--red); }
.side .who .viewas-form { margin: 0 0 10px; }
.side .who .viewas-form .btn.link { color: var(--red-soft); font-size: 13px; font-weight: 500; }
.viewas-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; background: var(--red-tint); border-radius: var(--r-sm); padding: 10px 16px; margin-bottom: 20px; font-size: 14px; }
.watch-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 0 26px; }
.code { font-family: Consolas, 'Courier New', monospace; background: var(--soft); padding: 4px 8px; border-radius: 6px; font-size: 15px; }
.side .who form { margin-top: 8px; }
main { padding: 28px 32px 48px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.page-head .sub { margin-top: 6px; color: var(--gray); max-width: 70ch; }

.logo-link { display: block; }
.org-pick { background: var(--side-hover); border-radius: var(--r-sm); padding: 10px 12px; }
.org-pick .lbl { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--side-mute); }
.org-pick select { width: 100%; margin-top: 4px; background: transparent; border: 0; color: var(--side-ink); font-weight: 700; font-size: 14px; padding: 0; cursor: pointer; }
.org-pick select option { color: #262626; }
.org-pick .fixed { margin-top: 4px; font-weight: 700; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.section { margin-top: 28px; }
.section > h2 { margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.num, .n { font-variant-numeric: tabular-nums; }
.caption { font-size: 13px; color: var(--gray); }
.empty { background: var(--soft); border-radius: var(--r-card); padding: 36px 28px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty p { max-width: 56ch; color: var(--gray); }

/* Таблицы: шапка INK, зебра (ithouse-design, раздел 6) */
.tw { overflow-x: auto; border-radius: var(--r-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--ink); color: var(--bg); text-align: left; font-weight: 700; font-size: 13px; padding: 10px 12px; white-space: nowrap; }
tbody td { padding: 10px 12px; vertical-align: top; }
tbody tr:nth-child(even) td { background: var(--soft); }
td.r, th.r { text-align: right; }
td.n { font-weight: 700; text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--red-tint); }

/* Пилюли и теги */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-btn); padding: 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid var(--line); color: var(--ink); background: var(--panel); text-decoration: none; }
.pill.hot { background: var(--red); border-color: var(--red); color: #fff; }
.pill.tint { background: var(--red-tint); border-color: transparent; }
.pill.solid { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill.off { color: var(--gray); border-style: dashed; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.timeline li { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.timeline .t { color: var(--gray); font-variant-numeric: tabular-nums; }

/* Услуги по договору: чекбоксы с датой включения */
.svc { display: grid; gap: 10px; }
.svc label { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; cursor: pointer; }
.svc input { width: 18px; height: 18px; accent-color: var(--red); margin-top: 2px; }
.svc .nm { font-weight: 700; }
.svc .ds { font-size: 13px; color: var(--gray); margin-top: 2px; }
.svc .since { font-size: 12px; color: var(--gray); white-space: nowrap; text-align: right; }
.svc label.on { border-color: var(--ink); }

/* Лента отзывов и карточка отзыва */
.nav a .cnt { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: var(--r-btn); padding: 1px 7px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.filters select, .filters input { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 7px 10px; font-size: 13px; }
.filters input { min-width: 0; width: 240px; }
.rv-list { display: flex; flex-direction: column; gap: 8px; max-width: 820px; }
.rv { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; text-decoration: none; }
.rv:hover { border-color: var(--gray); }
.rv .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--gray); }
.rv .txt { margin-top: 6px; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rv .bot { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rv .bot .when { margin-left: auto; font-size: 12px; color: var(--gray); }
.stars { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stars.neg { color: var(--red); }
.detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 26px; display: flex; flex-direction: column; gap: 22px; max-width: 820px; }
.quote { font-size: 16px; line-height: 1.55; max-width: 70ch; }
.block { border-top: 1px solid var(--line); padding-top: 18px; }
.block > .kicker { margin-bottom: 10px; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.comment { background: var(--soft); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; }
.comment b { font-size: 13px; }
.timeline li.internal .comment { background: var(--red-tint); }
.tags .pill input { accent-color: var(--red); margin: 0 2px 0 0; }
.detail textarea { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; background: var(--panel); resize: vertical; }

/* Ответ, согласование, шаблоны */
.tpl-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.tpl-row select { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 7px 10px; font-size: 13px; max-width: 100%; }
.appr { display: grid; gap: 16px; }
.appr-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.appr-card .reply { background: var(--soft); border-radius: var(--r-sm); padding: 14px 16px; line-height: 1.55; }
.appr-card .foot { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 16px; max-width: none; }
.appr-card .foot textarea { width: 100%; min-height: 60px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; background: var(--panel); }
.tpl { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; }
.tpl.off { opacity: .6; }
.tpl-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tpl-head .btn { margin-left: auto; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 860px) { .appr-card { grid-template-columns: minmax(0, 1fr); } }

/* Разбор негатива */
.signs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin: 10px 0 4px; font-size: 14px; }
.signs label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.signs input { accent-color: var(--red); margin-top: 3px; }
.detail input[type="text"] { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; background: var(--panel); }
details > summary { cursor: pointer; color: var(--gray); }
@media (max-width: 860px) { .signs { grid-template-columns: minmax(0, 1fr); } }

/* Отчёт на экране (та же разметка, что в PDF: templates/reports/body.html) */
.report { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 32px; display: flex; flex-direction: column; gap: 24px; max-width: 960px; }
.report .rh { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; }
.report .rh .logo { width: 150px; color: var(--ink); }
.rblock { border-top: 1px solid var(--line); padding-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.rblock.off { color: var(--gray); }
.rblock .hd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.report .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bars .row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 13px; }
.bars .track { height: 14px; background: var(--line); border-radius: var(--r-btn); overflow: hidden; }
.bars .fill { height: 100%; background: var(--bar); border-radius: var(--r-btn); }
.bars .row .n { text-align: right; font-weight: 700; }
table.rt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rt th { background: var(--ink); color: var(--bg); text-align: left; font-weight: 700; font-size: 13px; padding: 8px 12px; }
table.rt td { padding: 8px 12px; vertical-align: top; } table.rt tr:nth-child(even) td { background: var(--soft); }
table.rt .r, table.rt .n { text-align: right; } table.rt .n { font-weight: 700; }
.examples { display: flex; flex-direction: column; gap: 8px; }
.ex { background: var(--soft); border-radius: var(--r-sm); padding: 10px 12px; }
.plan { margin: 0; padding-left: 18px; }
.rfoot { font-size: 13px; color: var(--gray); border-top: 1px solid var(--line); padding-top: 16px; }

/* Рейтинг: матрица точки × площадки */
.ratings td { min-width: 150px; }
.rcell { display: flex; flex-direction: column; gap: 4px; }
.rcell input { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 5px 8px; font-size: 13px; }
.neg { color: var(--red); }
td.n.red { color: var(--red); }
.src { font-size: 11px; color: var(--gray); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; white-space: nowrap; }
.src.hot { color: #fff; background: var(--red); border-color: var(--red); }

/* Кнопки, карточки, сообщения */
.btn { border: 0; border-radius: var(--r-btn); padding: 9px 18px; font-weight: 500; font-size: 14px; cursor: pointer; background: var(--soft); color: var(--ink); white-space: nowrap; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--red-tint); }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-d); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.link { background: transparent; padding: 0; color: var(--side-mute); font-size: 12px; }
.btn.link:hover { color: var(--side-ink); background: transparent; }
.card { background: var(--soft); border-radius: var(--r-card); padding: 24px; }
.card.line { background: var(--panel); border: 1px solid var(--line); }
.stat .v { font-size: 36px; font-weight: 700; line-height: 1; }
.stat .v.red { color: var(--red); }
.stat .l { margin-top: 8px; color: var(--gray); font-size: 13px; }
.stat .d { margin-top: 4px; font-size: 13px; font-weight: 500; }
.card h3 { margin-bottom: 12px; }
.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.msg { border-radius: var(--r-sm); padding: 10px 14px; background: var(--soft); font-size: 14px; }
.msg.error { background: var(--red-tint); }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.form label { display: block; font-size: 13px; color: var(--gray); margin-bottom: 4px; }
.form input[type="text"], .form input[type="email"], .form input[type="password"] { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 10px 12px; }
.form .errorlist { margin: 4px 0 0; padding: 0; list-style: none; color: var(--red); font-size: 13px; font-weight: 500; }
.form .check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.form .check input { accent-color: var(--red); width: 16px; height: 16px; }
.form.wide { max-width: 960px; }
.form select, .form textarea, .form input[type="url"], .form input[type="number"], .form input[type="date"], .form input[type="file"] { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 10px 12px; }
.form .req { color: var(--red); }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.fgrid.one { grid-template-columns: minmax(0, 1fr); }

/* Экран входа: без меню, карточка по центру */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 32px; display: flex; flex-direction: column; gap: 22px; }
.auth .logo { width: 160px; color: var(--ink); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { padding: 14px 16px; gap: 12px; position: static; height: auto; overflow: visible; }
  .side .logo { width: 120px; margin: 0; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .nav .grp { display: none; }
  .nav a { white-space: nowrap; }
  .side .who { display: none; }
  main { padding: 20px 16px 40px; }
  h1 { font-size: 24px; }
  .g2, .g4, .fgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
