:root{
  --ink:#111; --mute:#555; --line:#9aa0a6; --soft:#e6e8eb; --bg:#e9ebee; --paper:#fff;
  --c0:#7f1d1d; --c1:#9a3412; --c2:#1e40af; --c3:#166534;
  --t0:#fde2e2; --t1:#ffedd5; --t2:#dbeafe; --t3:#dcfce7;
  --k-cw:#cfe3ff; --k-nd:#c9f2ec; --k-dg:#d6f5d0; --k-ph:#ffe9b0; --k-all:#ffd6b8;
  --k-bc:#e2e2e2; --k-sat:#e7dcff; --k-gd:#ffc9c9; --k-fm:#ffd3ec; --k-rp:#f6b7d9; --k-eme:#fecaca;
}
*{box-sizing:border-box}
html{-webkit-print-color-adjust:exact;print-color-adjust:exact}
body{margin:0;background:var(--bg);color:var(--ink);
  font-family:"Roboto Condensed","Arial Narrow","Liberation Sans Narrow","Segoe UI",Arial,sans-serif;
  font-size:8pt;line-height:1.18}
a{color:#1d4ed8}
.toolbar{position:sticky;top:0;z-index:5;display:flex;gap:10px;align-items:center;flex-wrap:wrap;
  padding:8px 16px;background:#1f2937;color:#fff;font:13px/1.3 "Segoe UI",Arial,sans-serif}
.toolbar a,.toolbar button{color:#fff;background:#374151;border:0;border-radius:6px;padding:6px 10px;text-decoration:none;font:inherit;cursor:pointer}
.toolbar a:hover,.toolbar button:hover{background:#4b5563}
.toolbar .sp{flex:1}
.sheet{width:210mm;height:297mm;margin:12px auto;padding:6mm 8mm 5mm;background:var(--paper);
  box-shadow:0 2px 12px rgba(0,0,0,.18);overflow:hidden;position:relative;display:flex;flex-direction:column}
.sheet.auto{height:auto;min-height:297mm}
@page{size:A4;margin:0}
@media print{
  body{background:#fff}
  .toolbar,.noprint{display:none!important}
  .sheet{margin:0;box-shadow:none;page-break-after:always;break-after:page}
  .sheet:last-child{page-break-after:auto;break-after:auto}
  .sheet.auto{min-height:0}
}
@media screen and (max-width:820px){
  .sheet{transform-origin:top left}
}
h1{font-size:14pt;margin:0;letter-spacing:.2px;line-height:1.05}
h2{font-size:10pt;margin:2.2mm 0 1mm;padding-bottom:.6mm;border-bottom:1.4px solid var(--ink);display:flex;gap:6px;align-items:baseline}
h2 small{font-weight:400;color:var(--mute);font-size:7.5pt}
.hdr{display:flex;justify-content:space-between;align-items:flex-end;border-bottom:2.5px solid var(--ink);padding-bottom:1.2mm}
.hdr .sub{color:var(--mute);font-size:7.5pt;text-align:right}
.foot{margin-top:auto;padding-top:1mm;border-top:.6px solid var(--line);color:var(--mute);font-size:6.3pt;display:flex;justify-content:space-between;gap:8px}
table{border-collapse:collapse;width:100%}
th,td{border:.5px solid var(--line);padding:.35mm 1mm;vertical-align:top;text-align:left}
th{background:#f1f3f5;font-weight:700;font-size:7pt}
td.n,th.n{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
td.c,th.c{text-align:center}
.mono{font-family:Consolas,"DejaVu Sans Mono",monospace}
.b{font-weight:700}
.mute{color:var(--mute)}
.small{font-size:6.8pt}

/* категории */
th.c0{background:var(--c0);color:#fff} th.c1{background:var(--c1);color:#fff}
th.c2{background:var(--c2);color:#fff} th.c3{background:var(--c3);color:#fff}
td.c0{background:var(--t0)} td.c1{background:var(--t1)} td.c2{background:var(--t2)} td.c3{background:var(--t3)}
td.no{background:repeating-linear-gradient(135deg,#fff 0 2px,#eee 2px 4px);color:#999;text-align:center}

/* виды */
.k{width:2.2mm;padding:0}
.k-cw{background:var(--k-cw)} .k-nd{background:var(--k-nd)} .k-dg{background:var(--k-dg)} .k-ph{background:var(--k-ph)}
.k-all{background:var(--k-all)} .k-bc{background:var(--k-bc)} .k-sat{background:var(--k-sat)} .k-gd{background:var(--k-gd)}
.k-fm{background:var(--k-fm)} .k-rp{background:var(--k-rp)} .k-eme{background:var(--k-eme)}
.legend{display:flex;flex-wrap:wrap;gap:1mm 2.2mm;font-size:6.5pt;font-weight:400;align-items:center}
.legend i{display:inline-block;width:3.2mm;height:2.6mm;border:.5px solid var(--line);vertical-align:-.4mm;margin-right:.8mm}

/* сводка */
.sum td,.sum th{padding:0 1.2mm;font-size:7.4pt;line-height:1.1}
.sum td.p{font-size:8.4pt;line-height:1.05;font-weight:700;text-align:left;white-space:nowrap;width:30mm}
.sum td.p small{font-size:6.4pt;font-weight:400;margin-left:1.2mm}
.sum td.band{font-weight:700;font-size:8pt;line-height:1.05;white-space:nowrap;width:22mm}

/* детальная таблица */
.det td,.det th{font-size:6.6pt;padding:0 .8mm;line-height:1.04}
.det td.p{text-align:center;width:7mm;font-variant-numeric:tabular-nums}
.det tr.bh td{background:#222;color:#fff;font-weight:700;font-size:7pt;padding:.1mm 1mm}
.det tr.bh td span{font-weight:400;opacity:.8;margin-left:2mm}
.det td.f{white-space:nowrap;font-variant-numeric:tabular-nums;width:19mm}
.det td.bw{width:8mm;text-align:right;color:var(--mute)}
.det td.note{color:#7c2d12;font-size:6.4pt;width:34mm}
.eme{font-size:6.4pt;color:#7f1d1d;border:.5px solid var(--line);border-top:0;padding:.4mm 1mm;background:#fff5f5}

.cols2{display:grid;grid-template-columns:1fr 1fr;gap:4mm}
.box{border:.6px solid var(--line);border-radius:1.2mm;padding:1.6mm 2mm}

/* регионы */
.tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:1.4mm}
.tile{display:flex;align-items:center;gap:2mm;border:.6px solid var(--line);border-radius:1.2mm;padding:1mm 1.6mm}
.tile .L{font:700 17pt/1 Consolas,"DejaVu Sans Mono",monospace;width:7mm;text-align:center}
.tile .R{font-size:8.6pt;line-height:1.1}
.call-big{font:700 13pt/1.1 Consolas,"DejaVu Sans Mono",monospace;letter-spacing:.5px}
.call-big .pf{color:var(--c0)} .call-big .dg{color:var(--c2)} .call-big .rg{color:var(--c3);text-decoration:underline} .call-big .sx{color:var(--ink)}

/* Q */
.q td{font-size:7.4pt;padding:.3mm 1mm}
.q td.code{font:700 9pt/1.1 Consolas,"DejaVu Sans Mono",monospace;width:11mm}
.abbr{display:grid;grid-template-columns:repeat(4,1fr);gap:0 3mm;font-size:7.2pt}
.abbr div{display:flex;gap:1.5mm;border-bottom:.4px dotted var(--line);padding:.25mm 0}
.abbr b{font-family:Consolas,"DejaVu Sans Mono",monospace;min-width:15mm}
.rst td{font-size:6.9pt;padding:.2mm .9mm}
.rst td.d{font-weight:700;text-align:center;width:4mm}

/* позывные */
.calls{column-count:4;column-gap:2.5mm;column-rule:.4px solid #d4d7db;font-size:6.9pt;line-height:1.16}
.calls .r{display:grid;grid-template-columns:15mm 1fr;border-bottom:.35px solid #d4d7db;padding:.1mm 0;break-inside:avoid}
.calls .cs{font:700 7.4pt/1.16 Consolas,"DejaVu Sans Mono",monospace}
.calls .who{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.calls .q{color:var(--mute)}
.calls .letter{grid-column:1/-1;font-weight:700;background:#eef0f2;padding:0 1mm;margin-top:.4mm}

/* index / edit */
.wrap{max-width:900px;margin:20px auto;padding:0 16px;font:14px/1.45 "Segoe UI",Arial,sans-serif}
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}
.card{background:#fff;border-radius:10px;padding:14px 16px;box-shadow:0 1px 4px rgba(0,0,0,.12)}
.card h3{margin:0 0 4px;font-size:16px}
.card p{margin:0 0 10px;color:#555;font-size:13px}
.btn{display:inline-block;background:#1f2937;color:#fff;border:0;border-radius:6px;padding:6px 12px;text-decoration:none;font:inherit;cursor:pointer;margin:2px 4px 2px 0}
.btn.sec{background:#e5e7eb;color:#111}
.msg{background:#fff7d6;border:1px solid #f0d97a;padding:8px 12px;border-radius:8px;margin:10px 0}
.err{background:#fde8e8;border-color:#f5a3a3}
.ed{width:100%;background:#fff;font-size:13px}
.ed td,.ed th{padding:4px 6px;font-size:13px}
.ed tr.sk td{color:#999;text-decoration:line-through}
.ed tr:hover td{background:#f5f8ff;cursor:pointer}
form.row{display:flex;flex-wrap:wrap;gap:8px;align-items:end;background:#fff;padding:12px;border-radius:10px;box-shadow:0 1px 4px rgba(0,0,0,.12)}
form.row label{display:flex;flex-direction:column;font-size:12px;color:#444}
form.row input[type=text],form.row input[type=password]{font:inherit;padding:5px 7px;border:1px solid #bbb;border-radius:5px}

/* фонетика */
.ph td{font-size:11pt;padding:.55mm 1.6mm;vertical-align:middle}
.ph td.L{font:700 17pt/1 Consolas,"DejaVu Sans Mono",monospace;text-align:center;width:11mm}
.ph td.w{font-weight:700;font-size:12.5pt}
.ph td.say{color:var(--mute);font-size:9.5pt}
.ph td.R{font:700 15pt/1 Arial,sans-serif;text-align:center;width:10mm;background:#f6f7f9}
.ph td.m{white-space:nowrap;width:30mm}
.ph tr:nth-child(even) td{background:#fafbfc}
.ph tr:nth-child(even) td.R{background:#eef0f2}
.dot,.dash{display:inline-block;height:2.2mm;background:#111;border-radius:1.1mm;margin-right:1.1mm;vertical-align:middle}
.dot{width:2.2mm}.dash{width:6.2mm}
.ph2 td{font-size:9pt;padding:.4mm 1.4mm;vertical-align:middle}
.ph2 td.L{font:700 12pt/1 Consolas,"DejaVu Sans Mono",monospace;text-align:center;width:9mm}
.ph2 .dot,.ph2 .dash{height:1.8mm}.ph2 .dot{width:1.8mm}.ph2 .dash{width:5mm}

td.all4{background:#fff7e0;text-align:center;font-weight:400!important;font-size:inherit;color:#5b3a00}
.sum td.all4{font-size:7.2pt}

/* репитеры */
.rpt td,.rpt th{font-size:8pt;padding:.5mm 1.2mm;vertical-align:middle}
.rpt th{font-size:7pt;white-space:nowrap}
.rpt td.city{font-weight:700}
.rpt td.out{font-weight:700;font-size:9.5pt;font-variant-numeric:tabular-nums}
.rpt tr:nth-child(odd) td{background:#fafbfc}
.warn{color:#b91c1c}
