:root {
  --green: #39ff14;
  --green-soft: rgba(57, 255, 20, 0.12);
  --green-strong: rgba(57, 255, 20, 0.22);
  --bg: #070b08;
  --bg-alt: #0e1510;
  --bg-panel: rgba(13, 20, 15, 0.92);
  --line: rgba(57, 255, 20, 0.14);
  --line-strong: rgba(57, 255, 20, 0.34);
  --text: #edf5ea;
  --text-dim: #98ab98;
  --text-muted: #59705e;
  --paper: #ffffff;
  --paper-text: #222;
  --paper-line: #d9d7cf;
  --yellow: #ffe56a;
  --sidebar-w: 220px;
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(57, 255, 20, 0.12), transparent 28%),
    linear-gradient(180deg, #081009 0%, #050805 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
}

.menu-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
  color: var(--green);
  cursor: pointer;
}

.menu-toggle svg {
  width: 18px;
  height: 18px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 90;
}

.sidebar-overlay.active {
  display: block;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 24px 0 20px;
  background: rgba(10, 17, 12, 0.97);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
  transition: transform 0.28s ease;
}

.sidebar-logo {
  padding: 0 20px 22px;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo img {
  height: 56px;
}

.sidebar-section {
  padding: 18px 14px 6px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 10px;
  padding: 10px 18px;
  border-left: 3px solid transparent;
  border-radius: 0 10px 10px 0;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 13px;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.sidebar-item:hover,
.sidebar-item.active {
  color: var(--green);
  background: rgba(57, 255, 20, 0.07);
  border-left-color: var(--green);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 10px;
}

.sidebar-footer span {
  color: var(--green);
  font-weight: 700;
}

.main {
  margin-left: var(--sidebar-w);
  padding: 28px 30px 40px;
}
body.sidebar-collapsed { --sidebar-w: 76px; }
html.sidebar-collapsed { --sidebar-w: 76px; }
.sidebar-collapse-toggle { position: absolute; top: 86px; right: -15px; z-index: 120; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--bg-panel); color: var(--green); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; }
.sidebar .sidebar-collapse-toggle { position: absolute !important; top: 86px !important; right: -15px !important; width: 30px !important; height: 30px !important; min-width: 30px !important; max-width: 30px !important; min-height: 30px !important; max-height: 30px !important; padding: 0 !important; border-radius: 50% !important; flex: 0 0 30px !important; }
.sidebar .sidebar-collapse-toggle svg { width: 15px !important; height: 15px !important; max-width: 15px !important; max-height: 15px !important; }
.sidebar-collapse-toggle:hover { background: var(--green); color: #061006; }
.sidebar-collapse-toggle svg { width: 15px; height: 15px; transition: transform 0.25s ease; }
html.sidebar-collapsed .sidebar-collapse-toggle svg { transform: rotate(180deg); }
html.sidebar-collapsed .sidebar-logo { padding: 0 10px 22px; text-align: center; }
html.sidebar-collapsed .sidebar-logo img { height: 34px; max-width: 44px; object-fit: contain; }
html.sidebar-collapsed .sidebar-section,
html.sidebar-collapsed .sidebar-footer { font-size: 0; padding-left: 0; padding-right: 0; text-align: center; }
html.sidebar-collapsed .sidebar-item { justify-content: center; gap: 0; margin-right: 0; padding: 11px 0; border-radius: 0; border-left-color: transparent; font-size: 0; }
html.sidebar-collapsed .sidebar-item svg { width: 18px; height: 18px; }
body.sidebar-collapsed .sidebar-collapse-toggle svg { transform: rotate(180deg); }
body.sidebar-collapsed .sidebar-logo { padding: 0 10px 22px; text-align: center; }
body.sidebar-collapsed .sidebar-logo img { height: 34px; max-width: 44px; object-fit: contain; }
body.sidebar-collapsed .sidebar-section,
body.sidebar-collapsed .sidebar-footer { font-size: 0; padding-left: 0; padding-right: 0; text-align: center; }
body.sidebar-collapsed .sidebar-item { justify-content: center; gap: 0; margin-right: 0; padding: 11px 0; border-radius: 0; border-left-color: transparent; font-size: 0; }
body.sidebar-collapsed .sidebar-item svg { width: 18px; height: 18px; }
@media (min-width: 769px) {
  html.sidebar-collapsed .sidebar-item:hover::after,
  body.sidebar-collapsed .sidebar-item:hover::after { content: attr(aria-label); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); z-index: 300; min-width: max-content; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(15,24,16,.98); color: var(--text); font-size: 12px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.35); pointer-events: none; }
  html.sidebar-collapsed .sidebar-item:hover::before,
  body.sidebar-collapsed .sidebar-item:hover::before { content: ""; position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); z-index: 301; border: 6px solid transparent; border-right-color: var(--line-strong); pointer-events: none; }
}

.breadcrumb {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 18px;
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb .current {
  color: var(--text-dim);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(57, 255, 20, 0.08), transparent 46%),
    rgba(12, 20, 14, 0.92);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.eyebrow,
.panel-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}

.hero h1 {
  max-width: 720px;
  margin-top: 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.04;
}

.hero h1 span {
  color: #fff4a4;
}

.hero-text {
  max-width: 760px;
  margin-top: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--green);
  color: #041104;
}

.btn-secondary {
  background: #fff6c3;
  color: #1f200f;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-small {
  padding: 9px 12px;
  font-size: 12px;
}

.quick-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 18px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 229, 106, 0.22);
  background: rgba(255, 229, 106, 0.08);
  color: #fff0a3;
  font-size: 12px;
  font-weight: 600;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.form-panel,
.preview-panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-header h2,
.model-head h3 {
  margin-top: 5px;
  font-size: 23px;
}

.progress-copy {
  min-width: 160px;
  text-align: right;
}

.progress-bar {
  width: 160px;
  height: 7px;
  margin-left: auto;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff0a3, var(--green));
  transition: width 0.25s ease;
}

#progressLabel {
  display: inline-block;
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-alt);
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(57, 255, 20, 0.08);
}

.field textarea {
  resize: vertical;
  min-height: 94px;
}

.span-2 {
  grid-column: span 2;
}

.tips-card,
.model-card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.tips-card {
  padding: 16px 18px;
}

.tips-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
}

.tips-card ul {
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.tips-card li::before {
  content: "-";
  color: #fff0a3;
  margin-right: 8px;
}

.model-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.model-link {
  text-decoration: none;
  color: #fff0a3;
  font-size: 12px;
  font-weight: 700;
}

.pdf-frame {
  width: 100%;
  height: 420px;
  border: 0;
  display: block;
  background: #fff;
}

.sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 16px;
  background: linear-gradient(180deg, rgba(13, 20, 15, 1), rgba(13, 20, 15, 0.92) 85%, rgba(13, 20, 15, 0));
}

.contract-paper {
  min-height: 920px;
  padding: 26px 30px 36px;
  border-radius: 22px;
  background: var(--paper);
  color: var(--paper-text);
  box-shadow: inset 0 0 0 1px var(--paper-line);
  overflow: visible;
}

#contractPreview {
  display: block;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  margin-bottom: 18px;
}

.doc-header {
  display: grid;
  grid-template-columns: 190px 1fr;
  border: 1px solid #515151;
  margin-bottom: 22px;
}

.doc-brand {
  display: flex;
  align-items: stretch;
  min-height: 86px;
  height: 100%;
  background: #000;
  overflow: hidden;
  border-right: 1px solid #515151;
}

.doc-brand-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.doc-brand-image {
  width: 100%;
  height: 100%;
}

.doc-header-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 86px;
  padding: 10px 16px;
  text-align: center;
}

.doc-header-title strong {
  font-size: 18px;
  font-weight: 700;
}

.doc-header-title span {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
}

.doc-body p {
  margin-bottom: 10px;
  line-height: 1.46;
  font-size: 14px;
  text-align: justify;
}

.contract-paper .highlight {
  background: linear-gradient(180deg, transparent 0%, transparent 18%, var(--yellow) 18%, var(--yellow) 87%, transparent 87%);
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 600;
}

.contract-paper .highlight-active {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(57, 255, 20, 0.16);
}

.contract-paper .section-title,
.contract-paper .annex-item-title {
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.signature-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 40px;
}

.signature-line {
  padding-top: 28px;
  border-top: 1px solid #666;
  text-align: center;
  font-size: 13px;
}

.signature-line span {
  font-weight: 700;
}

.signature-city-line {
  margin-top: 24px;
}

.page-break {
  page-break-before: always;
  break-before: page;
  height: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(11, 18, 13, 0.96);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

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

.toast-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
}

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

  .contract-paper {
    min-height: auto;
  }

  .preview-panel {
    height: auto;
  }

  #contractPreview {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 66px 14px 24px;
  }

  .hero,
  .form-panel,
  .preview-panel {
    padding: 18px;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .panel-header,
  .model-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .progress-copy,
  .progress-bar {
    width: 100%;
    min-width: 0;
  }

  .signature-block,
  .doc-header {
    grid-template-columns: 1fr;
  }

  .pdf-frame {
    height: 300px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .menu-toggle,
  .sidebar-overlay,
  .breadcrumb,
  .hero,
  .quick-fields,
  .form-panel,
  .btn,
  .toast {
    display: none !important;
  }

  .main {
    margin: 0;
    padding: 0;
  }

  .workspace,
  .preview-panel,
  .panel {
    display: block;
    border: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
  }

  .sticky {
    display: none !important;
  }

  .contract-paper {
    min-height: auto;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }
}
