:root {
  --navy: #12355b;
  --navy2: #1f4a78;
  --teal: #0f7b6c;
  --ink: #1e2b3a;
  --muted: #5b6b83;
  --line: #dbe4ee;
  --bg: #f4f7fb;
  --card: #ffffff;
  --green: #1e6b45;
  --green-bg: #e4f1e8;
  --red: #8e2323;
  --red-bg: #f7dcdc;
  --amber: #8a5c00;
  --amber-bg: #fdf3dd;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(18, 53, 91, .07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(900px 400px at 10% -10%, #e6eef7 0, transparent 60%),
              radial-gradient(700px 400px at 100% 0, #e9f4f1 0, transparent 55%);
  z-index: -1;
}
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.top { background: var(--navy); color: #fff; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 9px; }
.brand b { display: block; font-size: 16px; letter-spacing: .02em; }
.brand span { display: block; font-size: 11px; color: #b8cee2; }
.status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #cfe0ef; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #7fd1b9; box-shadow: 0 0 0 3px rgba(127,209,185,.18); }
.status.off i { background: #f0b46a; box-shadow: 0 0 0 3px rgba(240,180,106,.18); }

.hero { padding: 32px 0 18px; }
.kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); font-weight: 700; }
.hero h1 { margin: 6px 0 8px; font-size: clamp(26px, 4vw, 40px); line-height: 1.12; color: var(--navy); letter-spacing: -.02em; }
.hero p { margin: 0; max-width: 720px; color: var(--muted); font-size: 15px; }

.layout { display: grid; grid-template-columns: 1.05fr .95fr; gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 17px; color: var(--navy); letter-spacing: -.01em; }
.card-head .num {
  width: 26px; height: 26px; border-radius: 8px; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto;
}
.card-head .link { margin-left: auto; }
.link { background: none; border: 0; color: var(--teal); font: inherit; font-size: 12px;
  cursor: pointer; padding: 4px; }
.link:hover { text-decoration: underline; }

label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
input, select {
  width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid #cfdae6;
  border-radius: 9px; background: #fff; font: inherit; font-size: 14px; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,123,108,.10); }
input::placeholder { color: #9aa8b8; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 12px; }
.hint { margin: 10px 0 0; color: #7b8a9a; font-size: 11.5px; line-height: 1.45; }

.results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.results label { font-size: 11.5px; }
.results input { font-size: 15px; font-weight: 600; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 18px; }
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 12px 20px;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s;
}
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy2); }
.btn.ghost { background: #fff; border-color: #cfdae6; color: var(--navy); }
.btn.ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.result-card { border-top: 3px solid var(--teal); }
.verdict {
  border-radius: 12px; padding: 16px 18px; font-size: 20px; font-weight: 800;
  letter-spacing: -.01em; background: var(--amber-bg); color: var(--amber);
}
.verdict.ok { background: var(--green-bg); color: var(--green); }
.verdict.bad { background: var(--red-bg); color: var(--red); }
.verdict small { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0; margin-top: 2px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 14px; }
.metrics div { background: #f9fbfd; padding: 11px 12px; }
.metrics span { display: block; color: var(--muted); font-size: 11px; }
.metrics b { display: block; margin-top: 2px; font-size: 16px; color: var(--navy); }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 18px 0 8px; }
.chart-head h3 { margin: 0; font-size: 15px; color: var(--navy); }
.chart-head span { font-size: 11px; color: var(--muted); }
.chart-box { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 8px; }
#chart { width: 100%; height: auto; display: block; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { background: var(--navy); color: #fff; text-align: left; font-weight: 600; padding: 9px 10px; white-space: nowrap; }
td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: top; }
tr:nth-child(even) td { background: #f8fafc; }
td.ok { color: var(--green); font-weight: 700; }
td.bad { color: var(--red); font-weight: 700; }
#journal:empty { display: none; }
.foot { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0 30px; color: #8a98a6; font-size: 11.5px; flex-wrap: wrap; }

.print-only { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .topbar { height: 58px; }
  .hero { padding-top: 22px; }
  .card { padding: 15px; }
}
@media (max-width: 520px) {
  .wrap { width: calc(100% - 22px); }
  .grid2, .results { grid-template-columns: 1fr; }
  .actions .btn { flex: 1 1 100%; }
  .metrics { grid-template-columns: 1fr 1fr; }
}

@media print {
  @page { size: A4; margin: 15mm; }
  body { background: #fff; }
  body::before, header, main > .hero, main > .layout, main > .actions,
  main > .result-card, main > .card:not(.print-only), footer { display: none !important; }
  .print-only { display: block !important; }
  .print-only h2 { color: #12355b; font-size: 16pt; margin: 0 0 10mm; }
  .print-table { width: 100%; border-collapse: collapse; font-size: 10.5pt; }
  .print-table td { border: .5pt solid #9aa7b4; padding: 3mm; }
  .print-table td:first-child { width: 42%; color: #444; }
  .sign { margin-top: 12mm; font-size: 10.5pt; }
}

/* дополнительные элементы формы ввода */
.table-actions { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; align-items:center; }
.small-btn { font-size:12px; padding:8px 12px; border-radius:8px; }
.range-note { font-size:11.5px; color:#7b8a9a; }
.badge { display:inline-block; font-size:11px; padding:2px 7px; border-radius:999px; background:#eef3f8; color:#12355b; margin-left:6px; }
.calc-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:1px; background:#dbe4ee; border:1px solid #dbe4ee; border-radius:12px; overflow:hidden; margin-top:14px; }
.calc-grid div { background:#f9fbfd; padding:10px 12px; }
.calc-grid span { display:block; font-size:11px; color:#5b6b83; }
.calc-grid b { display:block; font-size:15px; color:#12355b; margin-top:2px; }
@media (max-width:700px){ .calc-grid{grid-template-columns:1fr 1fr;} }

.stats-block { margin-top: 16px; border-top: 1px dashed #dbe4ee; padding-top: 12px; }
#accStats td:first-child { color: #5b6b83; width: 46%; }
#accStats td:last-child { font-weight: 600; }

.range-sel { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #5b6b83; }
.range-sel select { padding: 5px 8px; width: auto; }

.range-top { display: flex; justify-content: flex-end; margin: -4px 0 10px; }
.range-top .range-sel { font-size: 12px; }
.range-top select { min-width: 180px; }

.char-table th { font-size: 12.5px; padding: 9px 6px; white-space: nowrap; }
.char-table th[id] { font-weight: 700; letter-spacing: .01em; }

.char-table thead tr.char-groups th {
  font-size: 10.5px; font-weight: 600; line-height: 1.15;
  white-space: normal; vertical-align: middle; text-align: center;
  padding: 8px 5px; background: #1f4a78;
}
.char-table thead tr.char-groups th:first-child {
  text-align: center; background: #6b7a8f; font-weight: 700; font-size: 11.5px;
}

.data-table th small { display: block; font-weight: 400; font-size: 9.5px; line-height: 1.15; opacity: .85; }

.char-table thead tr:nth-child(2) th:nth-child(-n+2) { background: #6b7a8f; }

.free-banner { margin-top:12px; border:1px solid #f0d48a; background:#fff8e6; color:#6b4f12; border-radius:10px; padding:10px 12px; font-size:12.5px; }
.free-banner a { color:#0f6b5c; font-weight:700; }
.license-status { padding:10px 12px; border-radius:10px; background:#eef4fa; color:#12355b; font-size:13px; border:1px solid #dbe4ee; }
.license-status.paid { background:#e4f1e8; color:#1e6b45; border-color:#bfe0c8; }
.license-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:12px; }
.license-row input { flex:1 1 320px; margin:0; }
.chart-box { position:relative; }
.watermark { position:absolute; inset:0; display:none; align-items:center; justify-content:center; pointer-events:none; font-size:64px; font-weight:800; color:rgba(18,53,91,.10); transform:rotate(-24deg); letter-spacing:8px; }
body.is-free .watermark { display:flex; }
body.is-free #wordBtn, body.is-free #printBtn { opacity:.45; }
