@font-face {
  font-family: "Arad";
  src: url("assets/fonts/AradVF.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #18201f;
  --ink-soft: #4b5754;
  --paper: #f7f5ee;
  --paper-bright: #fffef9;
  --metal: #e7ebe8;
  --line: #aeb8b3;
  --yellow: #f2c94c;
  --yellow-deep: #d9a900;
  --green: #176b4d;
  --green-light: #dcece4;
  --danger: #a9362a;
  --shadow-sheet: -8px 10px 0 rgba(24, 32, 31, 0.12), 0 20px 44px rgba(24, 32, 31, 0.08);
  --radius-sm: 4px;
  --radius-md: 8px;
  --space-1: 6px;
  --space-2: 12px;
  --space-3: 18px;
  --space-4: 26px;
  --space-5: 38px;
  --space-6: 56px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(24, 32, 31, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 32px;
  color: var(--ink);
  font-family: "Arad", Tahoma, "Segoe UI", Arial, sans-serif;
  line-height: 1.65;
  min-width: 300px;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.site-header {
  min-height: 104px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  background: var(--paper-bright);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 18px clamp(20px, 5vw, 72px);
}

.brand-mark {
  width: 44px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-overline {
  margin: 0 0 1px;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.25;
}

.document-id {
  min-width: 164px;
  display: grid;
  place-content: center;
  padding: 16px 30px;
  border-right: 2px solid var(--ink);
  background:
    repeating-linear-gradient(135deg, rgba(24, 32, 31, 0.12) 0 7px, transparent 7px 14px),
    var(--yellow);
}

.document-id span,
.document-id strong {
  padding: 1px 10px;
  background: var(--yellow);
}

.document-id span {
  font-size: 0.72rem;
  font-weight: 700;
}

.document-id strong {
  font-size: 1rem;
}

main {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
  padding: var(--space-6) 0 80px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(260px, 0.9fr);
  align-items: end;
  gap: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
}

.section-tag {
  width: max-content;
  margin: 0 0 var(--space-2);
  padding: 3px 10px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.intro h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.intro > p {
  max-width: 58ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.85fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
  padding-top: var(--space-6);
}

.calculation-form {
  position: relative;
  padding-right: 74px;
}

.form-rail {
  position: absolute;
  top: 10px;
  right: 0;
  bottom: 72px;
  width: 42px;
  display: flex;
  align-items: center;
  flex-direction: column;
}

.rail-node {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-weight: 900;
}

.rail-node.active {
  background: var(--yellow);
}

.rail-line {
  width: 2px;
  flex: 1;
  min-height: 130px;
  background: var(--ink);
}

.form-section {
  padding: 0 0 var(--space-6);
}

.form-section + .form-section {
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.step-stamp {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid var(--ink);
  background: var(--metal);
  font-size: 0.72rem;
  font-weight: 800;
}

.section-heading h3 {
  margin: -4px 0 2px;
  font-size: 1.35rem;
}

.section-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.field {
  display: grid;
  gap: 7px;
  align-content: start;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span:first-child {
  font-size: 0.88rem;
  font-weight: 800;
}

.field small {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.field select,
.money-input {
  width: 100%;
  min-height: 56px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper-bright);
}

.field select {
  padding: 0 14px;
  color: var(--ink);
  appearance: auto;
}

.money-input {
  display: grid;
  grid-template-columns: 1fr auto;
  overflow: hidden;
}

.money-input input {
  min-width: 0;
  border: 0;
  padding: 0 14px;
  background: transparent;
  color: var(--ink);
  font-family: "Arad", Tahoma, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.money-input input:focus {
  outline: none;
  background: #fff8d7;
}

.money-input input[readonly] {
  cursor: default;
  background: var(--metal);
  color: var(--ink-soft);
}

.money-input input[readonly]:focus {
  background: var(--metal);
}

.money-input b {
  display: grid;
  place-items: center;
  min-width: 55px;
  padding: 0 10px;
  border-right: 1px solid var(--line);
  background: var(--metal);
  font-size: 0.72rem;
}

.field.has-error .money-input {
  border-color: var(--danger);
  box-shadow: 4px 4px 0 rgba(169, 54, 42, 0.12);
}

.form-error {
  margin-bottom: var(--space-3);
  padding: 10px 12px;
  border: 1px solid var(--danger);
  background: #f9e5e1;
  color: #6f211a;
  font-size: 0.86rem;
  font-weight: 700;
}

.calculate-button {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 24px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(110deg, transparent 0 78%, rgba(255, 255, 255, 0.32) 78% 83%, transparent 83%),
    var(--yellow);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), box-shadow 180ms cubic-bezier(.2,.8,.2,1), background-color 180ms ease;
}

.calculate-button:hover {
  background-color: #f7d96f;
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}

.calculate-button:active {
  transform: translate(4px, 4px);
  box-shadow: 2px 2px 0 var(--ink);
}

.calculate-button svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
}

.result-sheet {
  position: sticky;
  top: 24px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper-bright);
  box-shadow: var(--shadow-sheet);
}

.sheet-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 11px 16px;
  border-bottom: 2px solid var(--ink);
  background:
    repeating-linear-gradient(135deg, rgba(24, 32, 31, 0.08) 0 6px, transparent 6px 12px),
    var(--yellow);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-seal {
  padding: 2px 9px;
  border: 1px solid var(--ink);
  background: var(--paper-bright);
}

.status-seal.complete {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.result-main {
  padding: var(--space-5) var(--space-4) var(--space-4);
  text-align: center;
}

.result-main p {
  margin: 0 0 var(--space-2);
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 700;
}

.result-main h2 {
  direction: ltr;
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.result-main > span {
  display: block;
  margin-top: var(--space-1);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 900;
}

.result-summary {
  margin: 0;
  border-top: 1px solid var(--line);
}

.result-summary > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.result-summary dt {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.result-summary dd {
  direction: ltr;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.process-line {
  direction: ltr;
  display: flex;
  align-items: center;
  padding: var(--space-4) var(--space-4) 0;
}

.process-line span {
  width: 11px;
  height: 11px;
  border: 2px solid var(--ink);
  background: var(--paper-bright);
  transform: rotate(45deg);
}

.process-line i {
  height: 2px;
  flex: 1;
  background: var(--ink);
  transform-origin: left;
}

.result-sheet.calculated .process-line i {
  animation: flow-in 600ms cubic-bezier(.16,1,.3,1) both;
}

.result-sheet.calculated .process-line span {
  background: var(--green);
}

@keyframes flow-in {
  from { transform: scaleX(0); filter: blur(2px); }
  to { transform: scaleX(1); filter: blur(0); }
}

.breakdown {
  padding: var(--space-4);
}

.breakdown-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.breakdown-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.breakdown-heading span {
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 900;
}

.breakdown ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.breakdown li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}

.breakdown li > span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--metal);
  font-size: 0.7rem;
  font-weight: 900;
}

.breakdown li p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.breakdown li strong {
  display: block;
  color: var(--ink);
  font-size: 0.8rem;
}

.step-note {
  display: block;
  margin: 2px 0 4px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.formula {
  direction: ltr;
  display: block;
  padding: 5px 7px;
  border: 1px solid var(--line);
  background: var(--metal);
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: "Arad", Tahoma, sans-serif;
  font-size: 0.72rem;
  text-align: left;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-4);
}

.secondary-button,
.text-button {
  min-height: 42px;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: white;
}

.secondary-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.text-button {
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.legal-note {
  margin: 0;
  padding: 12px var(--space-4) 10px;
  border-top: 1px solid var(--line);
  background: var(--metal);
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.75;
}

.legal-note strong {
  color: var(--ink);
}

.table-reference {
  margin-top: 72px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: var(--paper-bright);
}

.table-reference summary {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px var(--space-4);
  cursor: pointer;
  list-style: none;
}

.table-reference summary::-webkit-details-marker {
  display: none;
}

.table-reference summary span {
  display: grid;
}

.table-reference summary b {
  font-size: 1.05rem;
}

.table-reference summary small {
  color: var(--ink-soft);
}

.table-reference summary svg {
  width: 24px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  transition: transform 180ms ease;
}

.table-reference[open] summary svg {
  transform: rotate(180deg);
}

.table-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 16px var(--space-4);
  border-top: 1px solid var(--line);
  background: var(--metal);
}

.table-note p {
  max-width: 72ch;
  margin: 0;
  font-size: 0.8rem;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.74rem;
}

td input {
  width: 150px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  background: var(--paper-bright);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover {
  background: #fff9df;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 20px clamp(20px, 5vw, 72px);
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 48px));
  padding: 11px 16px;
  border: 1px solid var(--ink);
  background: var(--green);
  color: white;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 5px 5px 0 var(--ink);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

footer {
  margin-top: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px clamp(20px, 5vw, 72px);
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  text-align: center;
}

.footer-legal-ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.88);
}

.ref-badge {
  background: rgba(242, 201, 76, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(242, 201, 76, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.footer-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: 0.94rem;
  color: white;
}

.footer-credit strong {
  color: white;
  font-weight: 700;
}

.footer-version {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.65);
}

.footer-security {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.footer-security svg {
  flex-shrink: 0;
  color: var(--yellow);
}

.footer-sep {
  color: rgba(255, 255, 255, 0.28);
  user-select: none;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .result-sheet {
    position: relative;
    top: 0;
  }
}

@media (max-width: 680px) {
  .site-header {
    min-height: 84px;
  }

  .brand {
    padding: 14px 16px;
  }

  .brand-mark {
    width: 32px;
    height: 42px;
  }

  .brand-overline {
    display: none;
  }

  .document-id {
    min-width: 112px;
    padding: 12px;
  }

  main {
    width: min(100% - 28px, 1360px);
    padding-top: var(--space-5);
  }

  .intro {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .intro h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .workspace {
    padding-top: var(--space-5);
  }

  .calculation-form {
    padding-right: 0;
  }

  .form-rail {
    display: none;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    gap: var(--space-2);
  }

  .field-wide {
    grid-column: auto;
  }

  .result-sheet {
    box-shadow: -5px 7px 0 rgba(24, 32, 31, 0.12);
  }

  .table-reference {
    margin-top: var(--space-6);
  }

  .table-note {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  html,
  body {
    width: auto;
    min-width: 0;
    margin: 0;
    background: white;
    color: #000;
    font-size: 9pt;
    line-height: 1.42;
  }

  .site-header,
  .intro,
  .calculation-form,
  .table-reference,
  footer,
  .site-footer,
  .result-actions,
  .toast {
    display: none !important;
  }

  main,
  .workspace {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    display: block;
  }

  .result-sheet {
    position: static;
    width: 100%;
    min-height: 276mm;
    display: flex;
    flex-direction: column;
    overflow: visible;
    border: 1.25pt solid #000;
    border-radius: 0;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .sheet-topline {
    min-height: 0;
    padding: 7px 14px;
    border-bottom-width: 1.25pt;
    font-size: 8.5pt;
  }

  .status-seal {
    padding: 2px 8px;
  }

  .result-main {
    padding: 17px 16px 14px;
  }

  .result-main p {
    margin-bottom: 5px;
    font-size: 9pt;
  }

  .result-main h2 {
    font-size: 30pt;
    line-height: 1.05;
  }

  .result-main > span {
    margin-top: 4px;
    font-size: 8pt;
  }

  .result-summary {
    display: block;
    border-bottom: 1px solid #999;
  }

  .result-summary > div {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 6px 16px;
    border-bottom: 1px solid #bbb;
  }

  .result-summary dt {
    font-size: 8pt;
  }

  .result-summary dd {
    font-size: 8.75pt;
  }

  .process-line {
    padding: 10px 16px 0;
  }

  .process-line span {
    width: 8px;
    height: 8px;
    border-width: 1.2px;
  }

  .process-line i {
    height: 1px;
  }

  .breakdown {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 16px 12px;
  }

  .breakdown-heading {
    margin-bottom: 6px;
  }

  .breakdown-heading h3 {
    font-size: 10pt;
  }

  .breakdown-heading span {
    font-size: 7.25pt;
  }

  .breakdown ol {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .breakdown li {
    flex: 1;
    grid-template-columns: 23px minmax(0, 1fr);
    gap: 8px;
    align-content: start;
    padding: 9px 0;
    break-inside: avoid;
  }

  .breakdown li > span {
    width: 22px;
    height: 22px;
    font-size: 7pt;
  }

  .breakdown li p,
  .breakdown li strong {
    font-size: 8.75pt;
  }

  .step-note {
    margin: 3px 0 5px;
    line-height: 1.5;
  }

  .formula {
    padding: 5px 8px;
    font-size: 8pt;
    line-height: 1.4;
  }

  .sheet-topline,
  .legal-note {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .legal-note {
    margin-top: auto;
    padding: 9px 16px;
    border-top: 1px solid #333;
    background: #f2f2f2;
    color: #111;
    font-size: 8.25pt;
    line-height: 1.55;
    text-align: justify;
  }
}
