:root { --text:#1d1f1c; --muted:#6b706a; --line:#e3e6e0; --green:#2f7d1f; --bg:#f7f8f5; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--text); font:15px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.top { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:16px 24px; background:#fff; border-bottom:1px solid var(--line); }
.brand { font-weight:600; color:var(--text); text-decoration:none; }
nav a { margin-left:16px; color:var(--green); text-decoration:none; }
main { max-width:1000px; margin:0 auto; padding:24px 16px 48px; }
h1 { font-size:24px; margin:0 0 4px; }
h2 { font-size:17px; margin:0 0 12px; }
.muted { color:var(--muted); }
.hint { color:var(--muted); font-size:14px; }
.error { color:#b3261e; }
.ok { color:var(--green); }
.mono { font-family:ui-monospace, Menlo, Consolas, monospace; font-size:13px; word-break:break-all; }
.card { background:#fff; border:1px solid var(--line); border-radius:12px; padding:20px; margin:20px 0; }
.card.narrow { max-width:380px; margin:48px auto; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:16px; }
.project { display:block; text-decoration:none; color:inherit; margin:0; }
.project:hover { border-color:var(--green); }
.tiles { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:12px; margin-top:16px; }
.tile { background:#fff; border:1px solid var(--line); border-radius:12px; padding:14px 16px; }
.tile span { display:block; color:var(--muted); font-size:13px; }
.tile strong { display:block; font-size:24px; font-variant-numeric:tabular-nums; margin-top:4px; }
dl { margin:12px 0 0; }
dl div { display:flex; justify-content:space-between; border-top:1px solid var(--line); padding:6px 0; }
dt { color:var(--muted); font-size:13px; }
dd { margin:0; font-variant-numeric:tabular-nums; }
table { width:100%; border-collapse:collapse; font-size:14px; }
th, td { text-align:left; padding:8px 10px; border-bottom:1px solid var(--line); }
th { color:var(--muted); font-weight:500; }
td:not(:first-child), th:not(:first-child) { text-align:right; font-variant-numeric:tabular-nums; }
label { display:block; margin:14px 0 6px; font-size:14px; }
input, textarea { width:100%; padding:9px 11px; border:1px solid var(--line); border-radius:8px; font:inherit; background:#fff; }
textarea { font-family:ui-monospace, Menlo, Consolas, monospace; font-size:13px; }
button { margin-top:16px; padding:10px 18px; border:0; border-radius:8px; background:var(--green); color:#fff; font:inherit; cursor:pointer; }
.chart { width:100%; height:120px; }
.legend { font-size:13px; color:var(--muted); }
.dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin:0 4px 0 12px; }
.dot.green { background:var(--green); }
.dot.orange { background:#c46a1b; }
.bottom { max-width:1000px; margin:0 auto; padding:0 16px 32px; color:var(--muted); font-size:13px; }
@media (max-width:520px) { main { padding:16px 12px 32px; } .card { padding:16px; } }

.tabs { display:flex; gap:18px; margin:10px 0 4px; flex-wrap:wrap; }
.tabs a { color:var(--green); text-decoration:none; font-size:14px; padding-bottom:4px; border-bottom:2px solid transparent; }
.tabs a.active { color:var(--text); border-bottom-color:var(--green); }
.tile em { display:block; font-style:normal; font-size:13px; margin-top:2px; }
.up { color:var(--green); }
.down { color:#b3261e; }
.group-head { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.group-head form { margin:0; }
button.link { background:none; border:0; color:#b3261e; padding:0; margin:0; font-size:13px; cursor:pointer; }
button[disabled] { opacity:.5; cursor:not-allowed; }
@media print { .top, .tabs, form, .bottom { display:none !important; } .card { break-inside:avoid; border-color:#ccc; } }

.grouptabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.gtab { margin:0; padding:6px 12px; border-radius:20px; background:#eef1ec; color:var(--text); font-size:14px; }
.gtab.active { background:var(--green); color:#fff; }
.gtab.active .muted { color:#dff5d8; }
#qsearch { margin-bottom:6px; }
tr.watched td:first-child { border-left:3px solid var(--green); padding-left:7px; }
select { width:100%; padding:9px 11px; border:1px solid var(--line); border-radius:8px; font:inherit; background:#fff; }

th.sortable { cursor:pointer; user-select:none; }
th.sortable:hover { color:var(--text); }
th.sorted { color:var(--green); }

.tabslabel { margin:0 0 6px; font-size:13px; color:var(--muted); }
.grouptabs + .tabslabel { margin-top:12px; }

.region-line { display:flex; align-items:center; gap:6px; }
.help { position:relative; display:inline-flex; align-items:center; justify-content:center; width:17px; height:17px; border:1px solid var(--line); border-radius:50%; font-size:11px; line-height:1; color:var(--muted); background:#fff; cursor:help; }
.help:hover, .help:focus { border-color:var(--green); color:var(--green); outline:none; }
.help .tip { display:none; position:absolute; left:0; top:24px; width:min(340px, 80vw); padding:12px 14px; background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 8px 28px rgba(20,30,15,.12); color:var(--text); font-size:13px; line-height:1.45; text-align:left; cursor:auto; z-index:5; }
.help:hover .tip, .help:focus .tip, .help:focus-within .tip { display:block; }
@media (max-width:520px) { .help .tip { left:auto; right:0; } }
@media print { .help { display:none; } }

/* Переключатели периода и шага графика. */
.periods { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:14px 0 4px; }
.periods .tabslabel { margin:0 4px 0 0; }
.periods .gtab { text-decoration:none; }
.periods .gtab:not(.active):hover { background:#e3e9df; }

/* График: оси, сетка и подсказка. */
.chartbox { position:relative; margin-top:12px; }
.chartbox.loading { opacity:.5; }
.fgchart { width:100%; height:300px; display:block; }
.fg-grid { stroke:var(--line); stroke-width:1; }
.fg-axis { fill:var(--muted); font-size:11px; }
.fg-cursor { stroke:#b9bfb4; stroke-width:1; stroke-dasharray:3 3; }
.fg-tip { position:absolute; top:4px; padding:8px 10px; background:#fff; border:1px solid var(--line);
	border-radius:8px; font-size:13px; line-height:1.5; pointer-events:none; box-shadow:0 2px 8px rgba(0,0,0,.08); }
.fg-tip i { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }

/* Галочки метрик и запросов. */
.checks { display:flex; flex-wrap:wrap; gap:6px 18px; }
.checks label { display:flex; align-items:center; gap:6px; margin:0; font-size:14px; cursor:pointer; }
.checks input { width:auto; margin:0; }
.checks i { display:inline-block; width:9px; height:9px; border-radius:50%; }
.checks--scroll { display:block; max-height:230px; overflow:auto; border:1px solid var(--line);
	border-radius:8px; padding:10px 12px; margin-top:10px; columns:2; column-gap:24px; }
.checks--scroll label { break-inside:avoid; }
.checks__group { margin-bottom:10px; }
.checks__group:last-child { margin-bottom:0; }
.checks__title { display:block; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.03em; margin-bottom:4px; }
@media (max-width:520px) { .fgchart { height:240px; } }

/* Предупреждения, отметки работ и две колонки под «выросли / упали». */
.warnings { border-color:#e6c200; background:#fffdf2; }
.warnings ul { margin:0; padding-left:18px; }
.warnings li { margin:4px 0; }
.eventform { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:10px; }
.eventform input[type=date] { width:auto; }
.eventform input[type=text] { flex:1 1 320px; }
.eventform button { margin:0; }
.twocol { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:24px; }
.twocol h3 { font-size:14px; margin:0 0 8px; }
.checks__sep { margin-left:auto; color:var(--muted); }
.fg-mark { stroke:#8a3ab0; stroke-width:1; stroke-dasharray:2 3; opacity:.6; }
.fg-markdot { fill:#8a3ab0; }
@media (max-width:700px) { .twocol { grid-template-columns:1fr; } }
@media print { .noprint, .eventform, .checks { display:none !important; } }

/* Календарь «от и до» и график позиций под списком запросов. */
.daterange { display:inline-flex; align-items:center; gap:8px; margin:0; }
.daterange input[type=date] { width:auto; padding:5px 8px; font-size:14px; }
.daterange button { margin:0; padding:6px 12px; font-size:14px; }
.gtab.small { padding:3px 10px; font-size:13px; text-decoration:none; }
td.pick, th.pick { width:28px; text-align:center; padding-right:0; }
td.pick input { width:auto; margin:0; }
.posblock { margin-top:22px; padding-top:18px; border-top:1px solid var(--line); }
.posblock h2 { margin-bottom:6px; }
/* Динамика по запросам: широкая таблица с прокруткой и закреплённым запросом. */
/* Недель много: таблица остаётся в карточке и прокручивается вбок, запрос закреплён слева. */
.tablewrap { overflow-x:auto; max-width:100%; border:1px solid var(--line); border-radius:8px; }
.topscroll { position:sticky; top:0; z-index:3; overflow-x:auto; overflow-y:hidden; background:#fff; margin-bottom:4px; }
.topscroll > div { height:1px; }
.topscroll[hidden] { display:none; }
table.dyn td:nth-child(2), table.dyn th:nth-child(2) { text-align:left; white-space:normal; min-width:130px; max-width:180px; }
table.dyn td:first-child, table.dyn thead tr:first-child th:first-child { box-shadow:1px 0 0 var(--line); }
table.dyn { width:auto; min-width:100%; }
table.dyn th, table.dyn td { white-space:nowrap; }
table.dyn td:first-child, table.dyn thead tr:first-child th:first-child { position:sticky; left:0; background:#fff; z-index:1; white-space:normal; min-width:200px; max-width:260px; }
table.dyn th.month { text-align:center; color:var(--text); border-left:1px solid var(--line); }
table.dyn .monthstart { border-left:1px solid var(--line); }
table.dyn th small { display:block; font-size:11px; color:var(--muted); font-weight:400; }
table.dyn td.total { font-weight:600; }
.p3 { background:#d7efcf; } .p10 { background:#e9f6e4; } .p30 { background:#f6faf3; }
.swatch { display:inline-block; width:12px; height:12px; border-radius:3px; margin:0 4px 0 12px; vertical-align:-1px; border:1px solid var(--line); }
.periods + .periods { margin-top:8px; }
@media print { .topscroll { display:none !important; } .tablewrap { overflow:visible; } #grouptabs, #tiertabs, #besttabs, #qsearch, .periods, .tabslabel { display:none; } }
/* Отслеживаемые запросы: цифры и заголовки не переносим, при нехватке места таблица прокручивается вбок. */
table.qtable th, table.qtable td:not(:nth-child(2)) { white-space:nowrap; }
table.qtable td:nth-child(2) { min-width:220px; }
