/* ============ Токены ============ */
:root,
[data-theme='light'] {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.84rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  --text-xl: clamp(1.5rem, 1.25rem + 1vw, 2.125rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  --color-bg: #f3f6fa;
  --color-surface: #ffffff;
  --color-surface-2: #fafbfd;
  --color-surface-offset: #e9eef5;
  --color-surface-offset-2: #dfe6ef;
  --color-divider: #e2e8f0;
  --color-border: #d1d9e4;

  --color-text: #0f1720;
  --color-text-muted: #556274;
  --color-text-faint: #8b97a7;
  --color-text-inverse: #f7fafc;

  --color-primary: #124a9c;
  --color-primary-hover: #0d3a7d;
  --color-primary-highlight: #dde8f7;

  --color-success: #146b41;
  --color-success-highlight: #d8ece1;
  --color-warning: #8a4a12;
  --color-warning-highlight: #f6e6d4;
  --color-error: #a32436;
  --color-error-highlight: #f7dde1;

  --role-teacher: #0b6a62;
  --role-teacher-bg: #d8ece9;
  --role-student: #935110;
  --role-student-bg: #f7e6d2;
  --role-accountant: #3536a8;
  --role-accountant-bg: #e0e1f7;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px rgb(15 23 32 / 0.06);
  --shadow-md: 0 4px 14px rgb(15 23 32 / 0.08);
  --shadow-lg: 0 14px 36px rgb(15 23 32 / 0.13);

  --content-wide: 1240px;

  --font-display: 'Manrope', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme='dark'] {
  --color-bg: #0d1218;
  --color-surface: #141b24;
  --color-surface-2: #18212b;
  --color-surface-offset: #1b242f;
  --color-surface-offset-2: #222d3a;
  --color-divider: #212b37;
  --color-border: #2d3945;

  --color-text: #e0e6ed;
  --color-text-muted: #8b98a8;
  --color-text-faint: #616d7c;
  --color-text-inverse: #0f1720;

  --color-primary: #77a9ec;
  --color-primary-hover: #9bc2f4;
  --color-primary-highlight: #1b2b43;

  --color-success: #58bb87;
  --color-success-highlight: #162a20;
  --color-warning: #d3924f;
  --color-warning-highlight: #2c2318;
  --color-error: #e0798a;
  --color-error-highlight: #2e1b20;

  --role-teacher: #4fbdae;
  --role-teacher-bg: #12302d;
  --role-student: #d99b4a;
  --role-student-bg: #2f2416;
  --role-accountant: #9091f0;
  --role-accountant-bg: #1f2040;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 14px rgb(0 0 0 / 0.36);
  --shadow-lg: 0 14px 36px rgb(0 0 0 / 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
  }
}

/* ============ База ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}
body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
}
img,
svg {
  display: block;
  max-width: 100%;
}
input,
button,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: none;
}
table {
  border-collapse: collapse;
  width: 100%;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  text-wrap: balance;
  line-height: 1.2;
}
p {
  text-wrap: pretty;
}
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
a,
button,
input,
select,
label.check,
.card {
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
  z-index: 60;
  background: var(--color-surface);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.wrap {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.logo {
  width: 30px;
  height: 30px;
  color: var(--color-primary);
  flex: none;
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  background: var(--color-surface);
}
.icon-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.pill {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}
.pill-muted {
  color: var(--color-text-muted);
  background: var(--color-surface-offset);
}
.pill-active {
  color: var(--color-primary);
  background: var(--color-primary-highlight);
  border-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
  font-weight: 600;
}
@media (max-width: 560px) {
  .brand-sub,
  #header-count {
    display: none;
  }
}

/* ============ Intro ============ */
.intro {
  padding-block: var(--space-12) var(--space-8);
  max-width: 1240px;
}
.eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}
.intro h1 {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 24ch;
}
.lede {
  margin-top: var(--space-4);
  max-width: 74ch;
  color: var(--color-text-muted);
}
.intro-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
  list-style: none;
}
.intro-stats li {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.intro-stats strong {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--color-primary);
}
.intro-stats span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ============ Заголовки шагов ============ */
.step-title,
.step-title-plain {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-block: var(--space-12) var(--space-5);
}
.step-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ============ Роли ============ */
.role-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}
.role-tab {
  text-align: left;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
}
.role-tab:hover {
  border-color: var(--role-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.role-tab[aria-selected='true'] {
  border-color: var(--role-color);
  box-shadow: 0 0 0 1px var(--role-color) inset;
  background: var(--color-surface);
}
.role-tab-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.role-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--radius-md);
  background: var(--role-bg);
  color: var(--role-color);
}
.role-tab h3 {
  font-size: var(--text-base);
  font-weight: 700;
}
.role-tab .role-tag {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.role-tab p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.role-check {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  color: var(--role-color);
  opacity: 0;
}
.role-tab[aria-selected='true'] .role-check {
  opacity: 1;
}

.role-profile {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 92ch;
  margin-bottom: var(--space-5);
}
.callout {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--role-bg);
  border: 1px solid color-mix(in srgb, var(--role-color) 30%, transparent);
  margin-bottom: var(--space-6);
}
.callout svg {
  flex: none;
  color: var(--role-color);
  margin-top: 2px;
}
.callout h3 {
  font-size: var(--text-base);
  color: var(--role-color);
  margin-bottom: var(--space-2);
}
.callout p {
  font-size: var(--text-sm);
  max-width: 88ch;
  color: var(--color-text);
}

/* ============ Таблица требований ============ */
.req-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.req-table {
  min-width: 720px;
  font-size: var(--text-sm);
}
.req-table thead th {
  text-align: left;
  padding: var(--space-4);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.req-table thead th.col-opt {
  color: var(--role-color);
}
.req-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
}
.req-table tr:last-child td {
  border-bottom: none;
}
.req-table td.rowhead {
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-text);
  background: var(--color-surface-2);
  width: 150px;
}
.req-table td.col-opt {
  background: color-mix(in srgb, var(--role-bg) 75%, transparent);
}
.req-table ul {
  margin: 0;
  padding-left: 1.1em;
}
.req-table ul li {
  margin-bottom: var(--space-1);
}

/* ============ Компоновка фильтров + результатов ============ */
.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
.filters {
  position: sticky;
  top: 76px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
@media (max-width: 980px) {
  .filters {
    position: static;
  }
}
.filter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.filter-head h3 {
  font-size: var(--text-base);
  font-weight: 700;
}
.link-btn {
  font-size: var(--text-xs);
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.filter-group {
  border: none;
  padding: 0;
  margin-bottom: var(--space-6);
}
.filter-group legend {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.val {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  margin-left: auto;
}
.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
}
.segmented button {
  flex: 1;
  padding: var(--space-2) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: calc(var(--radius-md) - 2px);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.segmented button[aria-checked='true'] {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
input[type='range'] {
  width: 100%;
  height: 4px;
  appearance: none;
  background: var(--color-surface-offset-2);
  border-radius: var(--radius-full);
  margin-block: var(--space-2);
}
input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
input[type='range']::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-surface);
  cursor: pointer;
}
.scale {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
  cursor: pointer;
}
.check input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  flex: none;
}
.check span {
  color: var(--color-text-muted);
}
.check:hover span {
  color: var(--color-text);
}

/* ============ Результаты ============ */
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.results-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.sort-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.sort-wrap select {
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-4);
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  gap: var(--space-4);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
}
.card.in-spec {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary) inset;
}
.card-top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tag {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.tag-pass {
  background: var(--color-success-highlight);
  color: var(--color-success);
}
.tag-partial {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
}
.tag-fail {
  background: var(--color-error-highlight);
  color: var(--color-error);
}
.tag-form {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}
.card h3 {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.35;
}
.card .price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.card .price small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0;
}
.spec-rows {
  display: grid;
  gap: var(--space-2);
  font-size: var(--text-sm);
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-4);
}
.spec-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: baseline;
}
.spec-row dt {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
}
.spec-row dd {
  color: var(--color-text);
}
.metrics {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.metric {
  flex: 1 1 88px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.metric b {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.metric span {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.card .note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.gaps {
  font-size: var(--text-xs);
  color: var(--color-warning);
  background: var(--color-warning-highlight);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}
.card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: auto;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
}
.btn-ghost {
  border-color: var(--color-border);
  color: var(--color-text-muted);
  background: var(--color-surface);
}
.btn-ghost:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.card-actions .btn {
  flex: 1;
}
.empty {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-10) var(--space-6);
  text-align: center;
  background: var(--color-surface-2);
}
.empty h3 {
  font-size: var(--text-base);
  margin-bottom: var(--space-3);
}
.empty p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-inline: auto;
  max-width: 60ch;
  margin-bottom: var(--space-5);
}

/* ============ Спецификация ============ */
.spec-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 980px) {
  .spec-layout {
    grid-template-columns: 1fr;
  }
}
.card-surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.spec-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.spec-main,
.spec-form,
.results {
  min-width: 0;
}
html,
body {
  overflow-x: hidden;
}
.spec-table {
  font-size: var(--text-sm);
  min-width: 560px;
}
.spec-table thead th {
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.spec-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
.spec-table .num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.qty-ctl {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.qty-ctl button {
  width: 28px;
  height: 28px;
  color: var(--color-text-muted);
  font-weight: 700;
}
.qty-ctl button:hover {
  background: var(--color-surface-offset);
  color: var(--color-primary);
}
.qty-ctl input {
  width: 46px;
  text-align: center;
  border: none;
  border-inline: 1px solid var(--color-border);
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-1);
}
.row-del {
  color: var(--color-text-faint);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
}
.row-del:hover {
  color: var(--color-error);
  background: var(--color-error-highlight);
}
.spec-empty p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-6) 0;
  text-align: center;
}
.spec-total {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 2px solid var(--color-border);
  display: grid;
  gap: var(--space-2);
}
.total-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.total-row.grand {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-display);
  align-items: baseline;
}
.total-row .mono {
  color: var(--color-text);
  white-space: nowrap;
  flex: 0 0 auto;
}
.total-row > span:first-child {
  min-width: 0;
}
.total-row.grand .mono {
  color: var(--color-primary);
}
.spec-form h3 {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-4);
}
.spec-form label:not(.check) {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.spec-form input[type='text'] {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text);
}
.spec-form input[type='text']:focus {
  border-color: var(--color-primary);
  background: var(--color-surface);
}
.spec-actions {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

/* ============ Источники / футер ============ */
.sources {
  padding-bottom: var(--space-10);
}
.step-title-plain {
  font-size: var(--text-lg);
}
.sources ul {
  list-style: none;
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.sources li {
  font-size: var(--text-sm);
  padding-left: var(--space-4);
  border-left: 2px solid var(--color-border);
  color: var(--color-text-muted);
}
.sources a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.disclaimer {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  max-width: 100ch;
}
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-block: var(--space-6);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  transform: translate(-50%, 120%);
  background: var(--color-text);
  color: var(--color-surface);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), opacity 260ms;
  width: max-content;
  max-width: min(26rem, calc(100vw - 2.5rem));
  text-align: center;
}
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ============ PDF-шаблон ============ */
#pdf-stage {
  position: fixed;
  left: -4000px;
  top: 0;
  width: 794px;
  pointer-events: none;
}
#pdf-sheet {
  width: 794px;
  background: #ffffff;
  color: #111827;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  line-height: 1.45;
  padding: 40px 44px;
}
#pdf-sheet * {
  color: inherit;
}
#pdf-sheet .p-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #124a9c;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
#pdf-sheet .p-title {
  font-family: 'Manrope', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: #0f1720;
  line-height: 1.25;
  max-width: 460px;
}
#pdf-sheet .p-sub {
  font-size: 10px;
  color: #556274;
  margin-top: 4px;
}
#pdf-sheet .p-meta {
  font-size: 10px;
  color: #556274;
  text-align: right;
  line-height: 1.6;
}
#pdf-sheet h2.p-h2 {
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #124a9c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 18px 0 8px;
  border-bottom: 1px solid #d1d9e4;
  padding-bottom: 4px;
}
#pdf-sheet table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
#pdf-sheet th,
#pdf-sheet td {
  border: 1px solid #c9d2de;
  padding: 6px 7px;
  vertical-align: top;
  text-align: left;
}
#pdf-sheet th {
  background: #e9eef5;
  font-weight: 700;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #37465a;
}
#pdf-sheet td.num {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
#pdf-sheet tr.total td {
  background: #f3f6fa;
  font-weight: 700;
}
#pdf-sheet tr.grand td {
  background: #dde8f7;
  font-weight: 800;
  font-size: 11px;
}
#pdf-sheet .p-org {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
  font-size: 10px;
  margin-bottom: 4px;
}
#pdf-sheet .p-org div {
  border-bottom: 1px dotted #b9c3d1;
  padding: 3px 0;
}
#pdf-sheet .p-org b {
  color: #556274;
  font-weight: 600;
}
#pdf-sheet .p-note {
  background: #f3f6fa;
  border-left: 3px solid #124a9c;
  padding: 8px 10px;
  font-size: 10px;
  margin-top: 8px;
}
#pdf-sheet .p-note strong {
  color: #124a9c;
}
#pdf-sheet ul {
  margin: 4px 0 0 16px;
  font-size: 10px;
}
#pdf-sheet ul li {
  margin-bottom: 2px;
}
#pdf-sheet .p-sign {
  display: flex;
  gap: 40px;
  margin-top: 26px;
  font-size: 10px;
}
#pdf-sheet .p-sign div {
  flex: 1;
}
#pdf-sheet .p-sign .line {
  border-bottom: 1px solid #111827;
  height: 26px;
  margin-bottom: 4px;
}
#pdf-sheet .p-foot {
  margin-top: 20px;
  border-top: 1px solid #d1d9e4;
  padding-top: 8px;
  font-size: 8.5px;
  color: #7b879a;
}
#pdf-sheet .p-foot a {
  color: #124a9c;
  word-break: break-all;
}

/* Подсказка о горизонтальной прокрутке таблицы (только узкие экраны) */
.scroll-hint {
  display: none;
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
@media (max-width: 860px) {
  .scroll-hint {
    display: block;
  }
}
