/* ─────────────────────────────────────────────────────────────
   LoadCalc.zhezu.kz — unified design system
   ────────────────────────────────────────────────────────── */

:root {
  --primary: #0b6e56;
  --primary-600: #095a47;
  --primary-50: #e8f5f0;
  --accent: #c9a54b;
  --danger: #c53030;
  --danger-bg: #fee2e2;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --ok: #15803d;
  --ok-bg: #dcfce7;

  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #fafbf8;
  --border: #e6e4df;
  --border-strong: #c9c6bf;
  --text-1: #1a1d1a;
  --text-2: #4a4f4a;
  --text-3: #7a7f78;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; width: 100%; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
}
header .container {
  display: flex; align-items: center; gap: 28px;
  padding-top: 14px; padding-bottom: 14px;
  position: relative;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px;
  color: var(--text-1); text-decoration: none;
  letter-spacing: -0.01em;
}
.logo::before {
  content: "";
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.logo:hover { color: var(--primary); text-decoration: none; }

.topnav {
  display: flex; gap: 4px; margin-left: auto;
  align-items: center;
}
.topnav .nav-link {
  position: relative;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: 8px;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.topnav .nav-link:hover {
  color: var(--text-1);
  background: var(--primary-50);
  text-decoration: none;
}
.topnav .nav-link.active {
  color: var(--primary);
  background: var(--primary-50);
  font-weight: 600;
}

.menu-toggle {
  display: none;
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; cursor: pointer;
  margin-left: auto;
  font-size: 18px;
}

/* ── Main + Footer ──────────────────────────────────────── */
main { flex: 1; padding: 36px 0 60px; }
footer {
  margin-top: auto; padding: 24px 0;
  text-align: center; color: var(--text-3);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  margin-bottom: 32px;
  padding: 30px 36px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--primary-50) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(11,110,86,0.12) 0%, transparent 70%);
}
.hero h1 {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  position: relative;
}
.hero p {
  color: var(--text-2); font-size: 15.5px;
  max-width: 760px; position: relative;
}

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: #86efac; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #fca5a5; }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: #fcd34d; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  color: #fff; text-decoration: none;
}
.btn-secondary {
  background: var(--surface); color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}
.btn-ghost {
  background: transparent; color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--primary-50); color: var(--primary);
  border-color: var(--primary-50);
  text-decoration: none;
}
.btn-del {
  background: transparent; border: 1px solid var(--border);
  color: var(--danger);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
}
.btn-del:hover { background: var(--danger-bg); border-color: var(--danger); }

/* ── Forms ──────────────────────────────────────────────── */
input[type="text"], input[type="number"], input[type="file"],
input[type="email"], input[type="password"],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="file"] { padding: 7px 10px; font-size: 13px; cursor: pointer; }
input[type="file"]::file-selector-button {
  border: none;
  background: var(--primary-50);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 6px;
  margin-right: 10px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
input[type="file"]::file-selector-button:hover { background: var(--primary); color: #fff; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11,110,86,0.12);
}
input[type="checkbox"] { width: auto; accent-color: var(--primary); cursor: pointer; }
label { font-size: 13px; color: var(--text-2); font-weight: 500; }

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
fieldset legend {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-1);
  padding: 0 8px;
}
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > label { display: flex; flex-direction: column; gap: 6px; flex: 1 1 260px; }
.hint { color: var(--text-3); font-size: 13px; margin: 6px 0 14px; line-height: 1.5; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding: 16px 0; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="file"] { max-width: 240px; }

/* ── Workflow stage cards ───────────────────────────────── */
.workflow { display: grid; gap: 18px; margin-bottom: 32px; }
.workflow-step {
  display: flex; gap: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.workflow-step::before {
  content: ""; position: absolute;
  left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--primary);
}
.workflow-step:nth-child(2)::before { background: var(--accent); }
.workflow-step:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.step-badge {
  flex: 0 0 auto;
  padding: 6px 12px;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 12px; font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  height: fit-content;
}
.workflow-step:nth-child(2) .step-badge {
  background: #fdf7e7; color: var(--accent);
}
.step-body { flex: 1 1 auto; min-width: 0; }
.step-body h2 {
  font-size: 20px; font-weight: 700;
  margin-bottom: 6px; letter-spacing: -0.01em;
}
.step-role { color: var(--text-2); font-size: 14px; margin-bottom: 14px; }
.step-bullets {
  margin: 0 0 20px; padding-left: 20px;
  font-size: 14px; color: var(--text-2);
}
.step-bullets li { margin: 5px 0; }
.step-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Extras */
.extras { margin: 28px 0; }
.extras summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--text-2);
  font-size: 14px;
  display: flex; align-items: center; gap: 10px;
  transition: all 0.15s;
}
.extras summary::-webkit-details-marker { display: none; }
.extras summary::before {
  content: "▸"; transition: transform 0.2s; color: var(--text-3);
}
.extras[open] summary::before { transform: rotate(90deg); }
.extras summary:hover { background: var(--primary-50); border-color: var(--primary); }
.extras-body {
  display: flex; gap: 10px; flex-wrap: wrap; padding: 20px 0 10px;
}

/* ── Info block ─────────────────────────────────────────── */
.info-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 32px;
  box-shadow: var(--shadow-sm);
}
.info-block h2 {
  font-size: 19px; font-weight: 700;
  margin-bottom: 18px; letter-spacing: -0.01em;
}
.info-block h3 {
  font-size: 14px; font-weight: 600;
  color: var(--text-2); margin: 0 0 10px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.info-block .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.info-block table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-block th, .info-block td {
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.info-block th { font-weight: 600; color: var(--text-2); background: var(--surface-2); }
.info-block ul { list-style: none; padding: 0; }
.info-block ul li {
  padding: 6px 0 6px 20px; position: relative;
  font-size: 14px; color: var(--text-2);
}
.info-block ul li::before {
  content: ""; position: absolute;
  left: 0; top: 14px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--primary);
}

/* ── Import block (Ф.4.048-01) ──────────────────────────── */
.import-block {
  background: linear-gradient(135deg, var(--surface) 0%, var(--primary-50) 100%);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  margin-bottom: 24px;
}
.import-block h2 {
  font-size: 17px; font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary-600);
  display: flex; align-items: center; gap: 8px;
}
.import-block h2::before { content: "📥"; font-size: 20px; }
.import-block .hint { margin-top: 10px; }

/* ── Data grid tables ───────────────────────────────────── */
table.grid {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px; margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  /* overflow: hidden убран — ломает position:sticky у thead */
  background: var(--surface);
}
table.grid th {
  background: var(--surface-2);
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; color: var(--text-2);
  font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.03em;
  text-align: center; white-space: nowrap;
}
table.grid td {
  border-bottom: 1px solid var(--border);
  padding: 0; vertical-align: middle;
}
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: var(--primary-50); }
table.grid input, table.grid select {
  width: 100%; height: 36px;
  border: none; background: transparent;
  padding: 4px 8px; font-size: 13px;
  border-radius: 0;
}
table.grid input:focus, table.grid select:focus {
  background: #fff; box-shadow: inset 0 0 0 2px var(--primary);
}
table.grid td:last-child { text-align: center; padding: 4px; }

/* ── Summary stats ──────────────────────────────────────── */
.summary {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
  margin: 24px 0;
}
.summary .stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px; text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.summary .stat:hover { border-color: var(--primary); transform: translateY(-1px); }
.summary .stat span {
  display: block;
  font-size: 11px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 6px; font-weight: 500;
}
.summary .stat b {
  font-family: var(--font-num);
  font-size: 22px; color: var(--text-1);
  font-weight: 700;
}
.summary .stat.highlight {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
  border-color: var(--primary-600);
  color: #fff;
}
.summary .stat.highlight span { color: rgba(255,255,255,0.8); }
.summary .stat.highlight b { color: #fff; }

/* ── Result tables ──────────────────────────────────────── */
.result-table {
  width: 100%;
  border-collapse: separate;   /* separate нужен для sticky thead */
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  font-size: 13.5px;
}
/* Sticky thead — заголовки прилипают под шапкой сайта (высота из JS var --nav-h).
   Применяется к read-only .result-table И к редактируемым .grid на форме. */
.result-table thead th,
table.grid thead th {
  position: sticky;
  top: var(--nav-h, 67px);
  z-index: 10;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--border), 0 2px 4px rgba(0,0,0,0.05);
}
.result-table th {
  background: var(--surface-2);
  padding: 10px 12px;
  font-weight: 600; font-size: 12px;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.result-table tr:last-child td { border-bottom: none; }
.result-table tr:hover td { background: var(--surface-2); }
.result-table td:nth-child(2) { text-align: left; font-weight: 500; }
.result-table .total-row td {
  background: var(--primary-50);
  font-weight: 600;
  color: var(--primary-600);
}

/* ── FAQ ────────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 24px; }
.faq-group h2 {
  font-size: 18px; font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.faq-item:hover { border-color: var(--border-strong); }
.faq-item[open] { border-color: var(--primary); box-shadow: var(--shadow); }
.faq-item summary {
  padding: 14px 20px;
  cursor: pointer;
  font-weight: 500; font-size: 14.5px;
  display: flex; align-items: center; justify-content: space-between;
  list-style: none;
  transition: background 0.15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; color: var(--text-3);
  font-size: 22px; font-weight: 300;
  transition: transform 0.2s;
  line-height: 1;
}
.faq-item[open] summary::after { transform: rotate(45deg); color: var(--primary); }
.faq-item summary:hover { background: var(--primary-50); }
.faq-answer {
  padding: 10px 20px 18px;
  color: var(--text-2); font-size: 14px;
  border-top: 1px solid var(--border);
}
.faq-answer ol, .faq-answer ul { margin: 8px 0 8px 20px; }
.faq-answer li { margin: 4px 0; }
.faq-answer table {
  margin: 10px 0; border-collapse: collapse;
  width: 100%; font-size: 13px;
}
.faq-answer table th, .faq-answer table td {
  padding: 8px 10px; border: 1px solid var(--border);
  text-align: left;
}
.faq-answer table th { background: var(--surface-2); font-weight: 600; }
.faq-answer code {
  background: var(--surface-2);
  padding: 2px 6px; border-radius: 4px;
  font-family: var(--font-num); font-size: 12.5px;
  color: var(--primary-600);
}
.faq-screenshot {
  display: block; margin: 14px 0; padding: 8px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  text-align: center;
}
.faq-screenshot img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px; box-shadow: var(--shadow-sm);
}
.faq-caption {
  display: block; margin-top: 8px;
  font-size: 12px; color: var(--text-3); font-style: italic;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 880px) {
  .container { padding: 0 16px; }
  .hero { padding: 24px; }
  .hero h1 { font-size: 24px; }
  .workflow-step { flex-direction: column; gap: 14px; padding: 22px; }
  .workflow-step::before { width: 100%; height: 4px; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .info-block .info-grid { grid-template-columns: 1fr; gap: 28px; }
  .step-actions { flex-direction: column; align-items: stretch; }
  .step-actions .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input[type="file"] { max-width: 100%; }
  table.grid { font-size: 12px; }
  table.grid th { font-size: 10px; padding: 8px 4px; }
  table.grid input, table.grid select { font-size: 12px; height: 32px; }
}

@media (max-width: 640px) {
  .topnav {
    display: none;
  }
  .topnav.open {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; right: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px; min-width: 220px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
  }
  .topnav.open .nav-link { margin: 0; padding: 10px 14px; }
  .menu-toggle { display: inline-flex; align-items: center; }
  .summary { grid-template-columns: 1fr; }
  fieldset { padding: 16px; }
}

/* ── Utilities ──────────────────────────────────────────── */
.mono { font-family: var(--font-num); }

/* Tags for distribution */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tag-discipline { background: var(--primary-50); color: var(--primary); }
.tag-practice { background: #fdf7e7; color: var(--accent); }
.tag-gek { background: #fee2e2; color: var(--danger); }
table.grid tr.unassigned td { background: #fff5f5; }
table.grid tr.unassigned td:last-child input { background: #ffe4e4; }

/* Stage badges in nav */
.stage-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  letter-spacing: 0.03em;
  vertical-align: 1px;
}
.nav-link.active .stage-badge { background: var(--primary-600); }
.nav-link:not(.active) .stage-badge { background: var(--text-3); }
.nav-link:not(.active):hover .stage-badge { background: var(--primary); }

/* Fix overflow for 3rd workflow card */
.workflow-step:nth-child(3)::before { background: var(--primary); }
.workflow-step:nth-child(4)::before { background: var(--accent); }
.workflow-step:nth-child(3) .step-badge { background: var(--primary-50); color: var(--primary); }
.workflow-step:nth-child(4) .step-badge { background: #fdf7e7; color: var(--accent); }

/* TOC for FAQ */
.toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px;
  margin: 20px 0 24px; font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
}
.toc b { color: var(--text-2); }
.toc a {
  color: var(--primary); text-decoration: none;
  padding: 2px 8px; border-radius: 4px; transition: background 0.15s;
}
.toc a:hover { background: var(--primary-50); text-decoration: none; }
.faq-group { scroll-margin-top: 80px; }

/* Deadline banner */
.deadline-banner {
  padding: 10px 0; font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.deadline-banner.info { background: var(--primary-50); color: var(--primary-600); }
.deadline-banner.warning { background: #fef3c7; color: #92400e; }
.deadline-banner.error { background: #fee2e2; color: #b91c1c; }
.deadline-banner b { margin-right: 8px; }

/* Table reset for second-half items */
.result-section .result-table tbody tr:nth-child(even) td { background: var(--surface-2); }

/* ───── HUB-SYSTEM (универсальный язык всех этапов) ───── */
.hub-header { display:flex; justify-content:space-between; align-items:center; gap:32px; padding:20px 24px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); margin:16px 0 20px; flex-wrap:wrap; }
.hub-header.sticky { position:sticky; top:var(--nav-h, 60px); z-index:5; box-shadow:var(--shadow-sm); }
.hub-title { flex:1; min-width:0; }
.hub-eyebrow { font-size:11px; letter-spacing:0.08em; text-transform:uppercase; color:var(--accent); font-weight:600; }
.hub-h1 { font-size:22px; font-weight:600; color:var(--text-1); margin-top:2px; }
.hub-sub { font-size:13px; color:var(--text-3); margin-top:4px; }
.hub-progress { min-width:240px; flex-shrink:0; }
.progress-track { height:6px; background:var(--surface-2); border:1px solid var(--border); border-radius:99px; overflow:hidden; }
.progress-bar { height:100%; background:var(--primary); transition:width 320ms cubic-bezier(.16,1,.3,1); }
.progress-bar.complete { background:var(--ok); }
.progress-stats { margin-top:6px; font-size:12px; color:var(--text-2); text-align:right; font-family:var(--font-num); }

.hub-footer { margin-top:18px; padding:16px 24px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; }
.hub-footer.sticky { position:sticky; bottom:0; z-index:5; box-shadow:0 -2px 12px rgba(0,0,0,0.04); }
.hub-footer-stats { display:flex; gap:14px; color:var(--text-2); font-size:14px; flex-wrap:wrap; }
.hub-footer-stats b { color:var(--text-1); font-family:var(--font-num); font-weight:600; }
.hub-footer-stats .dot { color:var(--text-3); }

/* Чек-карточки (Stage 1, gates) */
.checklist { display:flex; flex-direction:column; gap:1px; background:var(--border); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.check-item { display:grid; grid-template-columns:64px 1fr 200px; gap:0; padding:18px 24px; background:var(--surface); align-items:center; transition:background 120ms; }
.check-item:hover { background:var(--surface-2); }
.check-item.done { background:rgba(11,110,86,0.03); }
.check-item.done:hover { background:rgba(11,110,86,0.06); }
.check-marker { font-size:24px; line-height:1; color:var(--text-3); }
.check-item.done .check-marker { color:var(--primary); }
.check-item.partial .check-marker { color:var(--accent); }
.check-body { display:flex; flex-direction:column; gap:8px; min-width:0; }
.check-head { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; }
.check-id { font-family:var(--font-num); font-size:11px; color:var(--text-3); font-weight:600; letter-spacing:0.04em; }
.check-head h3 { font-size:16px; font-weight:600; color:var(--text-1); margin:0; }
.check-pill { font-size:11px; text-transform:uppercase; letter-spacing:0.04em; padding:2px 10px; border-radius:99px; font-weight:600; margin-left:auto; }
.check-item.done .check-pill { background:var(--ok-bg); color:var(--ok); }
.check-item.todo .check-pill { background:var(--warn-bg); color:var(--warn); }
.check-item.partial .check-pill { background:rgba(201,165,75,0.18); color:#8a6c1f; }
.check-meta { display:flex; gap:24px; flex-wrap:wrap; margin:0; font-size:12px; }
.check-meta > div { display:flex; flex-direction:column; gap:2px; }
.check-meta dt { color:var(--text-3); font-size:10px; text-transform:uppercase; letter-spacing:0.04em; font-weight:600; margin:0; }
.check-meta dd { margin:0; color:var(--text-2); font-size:13px; }
.check-status { display:flex; align-items:baseline; gap:6px; margin-top:2px; }
.status-count { font-family:var(--font-num); font-size:22px; font-weight:600; color:var(--text-1); line-height:1; }
.check-item.todo .status-count { color:var(--text-3); }
.status-unit { font-size:12px; color:var(--text-3); }
.check-action { display:flex; justify-content:flex-end; }
.btn-cell { padding:10px 16px; font-size:13px; font-weight:600; color:var(--text-1); background:var(--surface); border:1px solid var(--border-strong); border-radius:var(--radius-sm); text-decoration:none; transition:all 120ms; white-space:nowrap; display:inline-block; }
.btn-cell:hover { border-color:var(--primary); color:var(--primary-600); background:var(--primary-50); }

/* Stat-cards (для сводок) */
.stats-row { display:flex; gap:24px; padding:20px 24px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); margin:16px 0; flex-wrap:wrap; }
.stat-card { display:flex; flex-direction:column; gap:4px; min-width:80px; }
.stat-card b { font-size:24px; font-family:var(--font-num); font-weight:600; color:var(--text-1); line-height:1; }
.stat-card b.accent { color:var(--primary); }
.stat-card b.warn { color:var(--warn); }
.stat-card span { font-size:11px; color:var(--text-3); text-transform:uppercase; letter-spacing:0.04em; margin-top:4px; }

/* Roadmap карточки (Index) */
.roadmap { display:flex; flex-direction:column; gap:1px; background:var(--border); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.roadmap-step { display:grid; grid-template-columns:80px 1fr 220px; gap:0; padding:20px 24px; background:var(--surface); align-items:center; transition:background 120ms; }
.roadmap-step:hover { background:var(--surface-2); }
.roadmap-step.done { background:rgba(11,110,86,0.03); }
.rd-badge { font-family:var(--font-num); font-size:14px; font-weight:600; color:var(--text-3); letter-spacing:0.04em; }
.roadmap-step.done .rd-badge { color:var(--primary); }
.roadmap-step.active .rd-badge { color:var(--accent); }
.rd-body h3 { font-size:17px; font-weight:600; color:var(--text-1); margin:0 0 4px; }
.rd-role { font-size:12px; color:var(--text-3); margin-bottom:8px; }
.rd-status { font-size:13px; color:var(--text-2); }
.rd-status b { font-family:var(--font-num); color:var(--text-1); }
.rd-action { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; }

/* Empty-states */
.empty { padding:48px 32px; text-align:center; background:var(--surface); border:1px dashed var(--border-strong); border-radius:var(--radius); }
.empty h2 { font-size:20px; color:var(--text-1); margin-bottom:8px; }
.empty p { color:var(--text-2); max-width:620px; margin:0 auto; }
.empty.empty-warn { border-color:var(--warn); background:var(--warn-bg); }
.empty.empty-warn h2 { color:var(--warn); }

/* Status tags для строк таблиц */
.status-tag { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; font-size:11px; text-transform:uppercase; letter-spacing:0.04em; font-weight:600; border-radius:99px; }
.status-tag.ok { background:var(--ok-bg); color:var(--ok); }
.status-tag.warn { background:var(--warn-bg); color:var(--warn); }
.status-tag.danger { background:var(--danger-bg); color:var(--danger); }
.status-tag.neutral { background:var(--surface-2); color:var(--text-2); border:1px solid var(--border); }

@media (max-width: 820px) {
  .hub-header { flex-direction:column; align-items:stretch; }
  .hub-progress { min-width:0; }
  .check-item, .roadmap-step { grid-template-columns:48px 1fr; }
  .check-action, .rd-action { grid-column:2; justify-content:flex-start; margin-top:8px; }
}

/* ── Печатная форма Ф.4.048-01 ───────────────────────────────────────────
   .print-only блоки скрыты на экране, проявляются только при печати/PDF. */
.print-only { display: none; }

@media print {
  /* Прячем весь экранный хром */
  header, footer, .deadline-banner, .menu-toggle, .topnav,
  .preview-head, .rs-grand, .rs-grid, .rs-actions, .rs-hint,
  .alert, .rs-eyebrow { display: none !important; }

  .print-only { display: block !important; }

  @page { size: A4 landscape; margin: 12mm 10mm 14mm; }

  html, body { background: #fff !important; color: #000 !important; }
  body { font-size: 10pt; line-height: 1.35; }
  main { padding: 0 !important; }
  .container { max-width: none !important; padding: 0 !important; }
  .report-saved, .course-preview {
    box-shadow: none !important; border: none !important;
    background: #fff !important; padding: 0 !important; margin: 0 !important;
  }

  /* Раскрываем все свёрнутые секции; summary → заголовок без треугольника */
  details > *:not(summary) { display: block !important; }
  details > summary {
    list-style: none; font-weight: 700; font-size: 11pt;
    margin: 5mm 0 1.5mm; padding: 0; cursor: auto;
  }
  details > summary::-webkit-details-marker,
  details > summary::marker { display: none; content: ""; }

  /* Таблицы — настоящая форма: рамки, повтор шапки на каждой странице */
  table.grid, .result-table {
    width: 100% !important; border-collapse: collapse !important;
    font-size: 8.5pt; margin: 0 0 4mm;
  }
  table.grid th, table.grid td,
  .result-table th, .result-table td {
    border: 0.5pt solid #000 !important; padding: 1.5px 4px !important;
    color: #000 !important; background: #fff !important;
  }
  table.grid thead th, .result-table thead th {
    background: #e8e8e8 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  thead { display: table-header-group; }      /* шапка повторяется на стр. */
  tfoot { display: table-footer-group; }
  tr, .tr-total, .total-row { break-inside: avoid; page-break-inside: avoid; }
  .tr-total td, .total-row td {
    font-weight: 700;
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  a[href]::after { content: ""; }             /* не печатать URL-ы */

  /* Бланк формы */
  .print-form-head { position: relative; margin-bottom: 5mm; }
  .pf-code { position: absolute; top: 0; right: 0; font-size: 9pt; }
  .pf-approve { width: 60%; margin-left: auto; text-align: left; font-size: 9pt;
                line-height: 1.5; }
  .pf-approve .pf-line { display: inline-block; min-width: 55mm;
                         border-bottom: 0.5pt solid #000; }
  .pf-org { text-align: center; font-weight: 700; margin: 4mm 0 1mm;
            font-size: 10pt; }
  .pf-title { text-align: center; font-weight: 700; font-size: 11pt;
              margin: 1mm 0 4mm; }
  .print-form-total { width: 70mm; margin: 5mm 0 6mm; }
  .print-form-sign { margin-top: 8mm; font-size: 10pt; }
  .print-form-sign .pf-line { display: inline-block; min-width: 55mm;
                              border-bottom: 0.5pt solid #000; }
  .print-form-sign .pf-cap { font-size: 8pt; color: #000; }

  /* Каждая ОП/секция — желательно с новой логической группой, но без
     насильных разрывов: разрешаем перенос только между таблицами */
  .course-preview { break-inside: auto; }
}
