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

:root {
  --ink: #1d1d1f;
  --muted: #515154;
  --teal: #0b7a69;
  --teal-bright: #0fa37f;
  --blue: #2456d6;
  --pencil: #2456d6;
  --red-margin: rgba(226, 94, 118, 0.28);
  --paper: #fbfdf9;
  --glass: rgba(255, 255, 255, 0.9);
  --border: rgba(15, 23, 42, 0.1);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: #f5f9fa;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Onest", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  position: relative;
}

/* Full-page notebook graph paper matching makary.pro/8potok/ */
.nb-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(620px circle at 10% 8%, rgba(15, 163, 127, 0.12), transparent 64%),
    radial-gradient(580px circle at 92% 16%, rgba(46, 107, 255, 0.1), transparent 64%),
    linear-gradient(to right, rgba(14, 155, 176, 0.072) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(14, 155, 176, 0.072) 1px, transparent 1px),
    linear-gradient(to right, rgba(36, 86, 214, 0.052) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(36, 86, 214, 0.052) 1px, transparent 1px);
  background-size:
    100% 100%,
    100% 100%,
    28px 28px,
    28px 28px,
    140px 140px,
    140px 140px;
  background-position: 0 0, 0 0, -1px -1px, -1px -1px, -1px -1px, -1px -1px;
}

.nb-margin-left,
.nb-margin-right {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 2px;
  pointer-events: none;
  z-index: 0;
  display: none;
}

.nb-margin-left {
  left: clamp(24px, 4vw, 64px);
  background: linear-gradient(
    180deg,
    rgba(226, 94, 118, 0.08) 0%,
    rgba(226, 94, 118, 0.25) 18%,
    rgba(226, 94, 118, 0.22) 82%,
    rgba(226, 94, 118, 0.08) 100%
  );
}

.nb-margin-right {
  right: clamp(24px, 4vw, 64px);
  background: repeating-linear-gradient(
    to bottom,
    rgba(36, 86, 214, 0.16) 0 10px,
    transparent 10px 18px
  );
}

@media (min-width: 1180px) {
  .nb-margin-left,
  .nb-margin-right {
    display: block;
  }
}

a {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--blue);
}

/* Sticky Top Navigation */
.nb-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 12px clamp(14px, 3vw, 28px);
  background: rgba(245, 249, 250, 0.86);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.nb-topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
}

.nb-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 999px;
  background: #1d1d1f;
  color: #ffffff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.nb-back-btn:hover {
  color: #ffffff;
  background: var(--teal);
  transform: translateY(-1px);
}

.nb-doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nb-doc-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nb-doc-pill:hover {
  color: var(--ink);
  border-color: rgba(14, 155, 176, 0.36);
  background: #ffffff;
}

.nb-doc-pill.is-active {
  background: linear-gradient(92deg, #0a7a60, #0a6f80 55%, #2456d6);
  color: #ffffff;
  border-color: transparent;
}

/* Main Notebook Page Container */
.nb-wrap {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: clamp(20px, 4vw, 44px) auto clamp(48px, 6vw, 76px);
  padding: 0 clamp(12px, 3vw, 24px);
}

/* Notebook Paper Sheet */
.nb-sheet-shell {
  position: relative;
  filter: drop-shadow(0 28px 50px rgba(15, 55, 75, 0.14));
}

.nb-torn {
  display: block;
  width: 100%;
  height: 15px;
  pointer-events: none;
  user-select: none;
}

.nb-torn--top {
  margin-bottom: -1px;
}

.nb-torn--bottom {
  margin-top: -1px;
}

.nb-sheet {
  position: relative;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, rgba(14, 155, 176, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(14, 155, 176, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  padding: clamp(24px, 4.5vw, 52px) clamp(20px, 4.8vw, 56px) clamp(28px, 4.5vw, 52px)
    clamp(26px, 6vw, 74px);
  border-left: 1px solid rgba(15, 23, 42, 0.06);
  border-right: 1px solid rgba(15, 23, 42, 0.06);
}

/* Vertical red notebook margin inside sheet */
.nb-sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: clamp(14px, 3.6vw, 46px);
  width: 1.5px;
  background: var(--red-margin);
  pointer-events: none;
}

/* Header inside notebook sheet */
.nb-header {
  position: relative;
  padding-bottom: 22px;
  border-bottom: 1.5px dashed rgba(15, 23, 42, 0.14);
  margin-bottom: 26px;
}

.nb-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.nb-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #e3f8f0;
  border: 1px solid rgba(15, 163, 127, 0.25);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nb-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.nb-title {
  margin: 0 0 12px;
  font-size: clamp(25px, 3.8vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.032em;
  font-weight: 800;
  color: var(--ink);
  text-wrap: balance;
}

.nb-subtitle {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 66ch;
}

/* Handwritten pencil margin notes */
.nb-pencil {
  font-family: "Caveat", cursive;
  color: var(--pencil);
  font-size: clamp(21px, 2.5vw, 25px);
  font-weight: 600;
  line-height: 1.08;
}

.nb-pencil-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(36, 86, 214, 0.06);
  border: 1.5px dashed rgba(36, 86, 214, 0.3);
  transform: rotate(-0.8deg);
}

.nb-pencil-callout {
  position: relative;
  margin: 18px 0 22px;
  padding: 16px 20px 16px 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 253, 232, 0.92), rgba(242, 249, 255, 0.92));
  border: 1.5px dashed rgba(36, 86, 214, 0.34);
  box-shadow: 0 12px 26px -20px rgba(36, 86, 214, 0.35);
}

.nb-pencil-callout--teal {
  background: linear-gradient(135deg, rgba(227, 248, 240, 0.88), rgba(235, 245, 255, 0.88));
  border-color: rgba(11, 122, 105, 0.35);
}

.nb-pencil-callout--warn {
  background: linear-gradient(135deg, rgba(255, 246, 234, 0.94), rgba(255, 252, 245, 0.95));
  border-color: rgba(217, 119, 6, 0.38);
}

.nb-pencil-tag {
  display: inline-block;
  font-family: "Caveat", cursive;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--pencil);
  margin-bottom: 6px;
  transform: rotate(-1.2deg);
}

.nb-pencil-callout--teal .nb-pencil-tag {
  color: var(--teal);
}

.nb-pencil-callout--warn .nb-pencil-tag {
  color: #b45309;
}

.nb-pencil-callout p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
}

.nb-pencil-callout p + p {
  margin-top: 8px;
}

/* Quick Table of Contents */
.nb-toc {
  margin: 0 0 28px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.nb-toc-title {
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal);
  margin: 0 0 10px;
}

.nb-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 6px 18px;
}

.nb-toc-list a {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 2px 0;
}

.nb-toc-list a:hover {
  color: var(--teal);
  text-decoration: underline;
}

/* Legal Document Typography */
.nb-section {
  scroll-margin-top: 84px;
  margin-bottom: 28px;
}

.nb-section h2 {
  margin: 0 0 12px;
  font-size: clamp(19px, 2.3vw, 23px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 750;
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.nb-section h2 .nb-sec-note {
  font-family: "Caveat", cursive;
  font-size: 22px;
  font-weight: 600;
  color: var(--pencil);
  transform: rotate(-1.5deg);
}

.nb-section h3 {
  margin: 16px 0 8px;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
}

.nb-section p {
  margin: 0 0 10px;
  color: #242428;
}

.nb-section ul,
.nb-section ol {
  margin: 6px 0 14px;
  padding-left: 22px;
}

.nb-section li {
  margin-bottom: 7px;
  color: #242428;
}

.nb-section li strong {
  color: var(--ink);
}

/* Responsive Data Tables */
.nb-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0 18px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.9);
}

.nb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.48;
  min-width: 520px;
}

.nb-table th,
.nb-table td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.nb-table th {
  background: rgba(14, 155, 176, 0.08);
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

.nb-table tr:last-child td {
  border-bottom: 0;
}

/* Requisites Card */
.nb-requisites {
  margin-top: 26px;
  padding: 20px 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(11, 122, 105, 0.24);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px 24px;
}

.nb-req-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nb-req-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.nb-req-val {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
  word-break: break-word;
}

/* Bottom signature & print actions */
.nb-sign-row {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1.5px dashed rgba(15, 23, 42, 0.14);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
}

.nb-signature {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nb-signature-name {
  font-family: "Caveat", cursive;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--blue);
  transform: rotate(-2deg);
}

.nb-signature-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.nb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nb-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.nb-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.nb-btn--primary {
  border: 0;
  background: linear-gradient(92deg, #0a7a60, #0a6f80 55%, #2456d6);
  color: #ffffff;
}

.nb-btn--primary:hover {
  color: #ffffff;
  filter: brightness(1.06);
}

/* Footer */
.nb-footer {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: 0 auto 36px;
  padding: 0 clamp(14px, 3vw, 24px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  font-size: 13px;
  color: var(--muted);
}

.nb-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.nb-footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
}

.nb-footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Mobile Polish (320px+) */
@media (max-width: 640px) {
  body {
    font-size: 15px;
  }
  .nb-topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .nb-doc-nav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .nb-doc-nav::-webkit-scrollbar {
    display: none;
  }
  .nb-sheet {
    padding: 20px 16px 24px 24px;
  }
  .nb-sheet::before {
    left: 11px;
  }
}

/* Print-friendly PDF save */
@media print {
  .nb-bg,
  .nb-margin-left,
  .nb-margin-right,
  .nb-topbar,
  .nb-torn,
  .nb-actions {
    display: none !important;
  }
  body {
    background: #ffffff;
    font-size: 12pt;
  }
  .nb-wrap {
    margin: 0;
    padding: 0;
    max-width: none;
  }
  .nb-sheet {
    background: #ffffff;
    padding: 0;
    border: 0;
  }
  .nb-sheet::before {
    display: none;
  }
}
