:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --ink: #20242a;
  --muted: #6d7580;
  --line: #d9dee5;
  --accent: #245b73;
  --accent-2: #e0a323;
  --soft: #f7f9fb;
  --paper: #ffffff;
  --danger: #ad3d3d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  min-height: 100vh;
}

.workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  color: white;
  font-weight: 800;
  border-radius: 8px;
  background: var(--accent);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

.brand-row p,
.muted {
  color: var(--muted);
}

.tabs,
.document-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.document-tabs {
  grid-template-columns: repeat(2, minmax(120px, 170px));
  width: fit-content;
}

.tab-button,
.doc-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.tab-button.is-active,
.doc-tab.is-active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 3px rgba(32, 36, 42, 0.12);
}

.editor-form {
  display: block;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #343a42;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.design-grid {
  display: grid;
  gap: 10px;
}

.design-card {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.design-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.swatch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 48px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.swatch span {
  display: block;
}

.design-title {
  font-weight: 800;
}

.design-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 10px;
  margin-top: auto;
}

.inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.score-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.score-box > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.score-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#scoreValue {
  color: var(--accent);
  font-size: 30px;
  line-height: 1;
}

.score-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5ea;
}

.score-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 180ms ease;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 9px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.check-dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: white;
  background: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.check-item.is-done .check-dot {
  background: #27735f;
}

.check-title {
  display: block;
  font-weight: 850;
}

.check-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.save-status {
  min-height: 30px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 750;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  font-weight: 800;
}

.primary-button {
  color: white;
  background: var(--accent);
}

.secondary-button {
  color: var(--accent);
  background: white;
}

.preview-area {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 24px;
  overflow: auto;
}

.paper-wrap {
  display: grid;
  justify-items: center;
}

.paper {
  width: min(100%, 880px);
  min-height: 1120px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(32, 36, 42, 0.16);
}

.document {
  --accent: #245b73;
  --accent-2: #e0a323;
  --soft: #f3f7f8;
}

.theme-kfz {
  --accent: #26343d;
  --accent-2: #f2b12d;
  --soft: #f5f6f4;
}

.theme-care {
  --accent: #28665f;
  --accent-2: #c65f58;
  --soft: #eef8f5;
}

.theme-office {
  --accent: #334f75;
  --accent-2: #7b8a35;
  --soft: #f2f5f8;
}

.theme-it {
  --accent: #1f5f7a;
  --accent-2: #4a8f61;
  --soft: #eff8fa;
}

.theme-creative {
  --accent: #7b3f59;
  --accent-2: #d18934;
  --soft: #fbf2f4;
}

.cv-header {
  display: grid;
  grid-template-columns: 155px 1fr;
  gap: 28px;
  align-items: center;
  padding: 42px;
  color: white;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, black));
}

.photo-frame {
  position: relative;
  width: 145px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 4px solid color-mix(in srgb, var(--accent-2) 70%, white);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
}

.photo-frame img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-frame.has-image img {
  display: block;
}

.photo-frame.has-image span {
  display: none;
}

.photo-frame span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 800;
}

.eyebrow {
  color: var(--accent-2);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.identity h2 {
  margin-top: 8px;
  font-size: 44px;
  line-height: 1;
}

.identity p:last-child {
  margin-top: 14px;
  max-width: 62ch;
  line-height: 1.55;
}

.cv-body {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 32px;
  padding: 34px 42px 46px;
}

.cv-sidebar {
  display: grid;
  align-content: start;
  gap: 24px;
  padding-right: 26px;
  border-right: 1px solid var(--line);
}

.cv-main {
  display: grid;
  align-content: start;
  gap: 30px;
}

.paper h3 {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.timeline,
.line-list {
  display: grid;
  gap: 10px;
}

.timeline {
  gap: 18px;
}

.timeline-item {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 12px 0 14px 22px;
  line-height: 1.45;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent-2);
}

.timeline-item + .timeline-item {
  margin-top: 2px;
}

.timeline-head {
  display: grid;
  grid-template-columns: minmax(92px, max-content) 1fr;
  gap: 12px;
  align-items: start;
}

.timeline-date {
  display: inline-block;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--accent);
  background: var(--soft);
  font-size: 13px;
  font-weight: 900;
}

.timeline-title {
  font-weight: 820;
}

.timeline-detail,
.timeline-details {
  color: var(--muted);
}

.timeline-detail-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.timeline-details {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-left: 16px;
}

.timeline-details li::marker {
  color: var(--accent-2);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--soft);
  font-size: 13px;
  font-weight: 750;
}

.document-letter {
  padding: 46px 54px;
}

.letter-topline {
  height: 8px;
  margin: -46px -54px 36px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.letter-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.letter-name {
  color: var(--accent);
  font-size: 26px;
  font-weight: 900;
}

.compact {
  margin-top: 8px;
  gap: 4px;
}

.letter-badge {
  align-self: start;
  padding: 9px 12px;
  border-radius: 8px;
  color: white;
  background: var(--accent);
  font-weight: 800;
}

.letter-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 30px;
  margin-top: 34px;
  line-height: 1.5;
}

.recipient-block {
  max-width: 300px;
}

.letter-subject {
  margin-top: 34px;
  color: var(--accent);
  font-size: 17px;
  font-weight: 900;
}

.letter-content {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  font-size: 16px;
  line-height: 1.68;
}

.letter-content .subject {
  color: var(--accent);
  font-weight: 900;
}

.letter-content .closing {
  margin-top: 12px;
}

.letter-content .signature {
  margin-top: -8px;
  color: var(--accent);
  font-weight: 900;
}

.is-hidden {
  display: none;
}

.print-bundle {
  display: none;
}

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

  .workspace-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .paper {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .workspace-panel,
  .preview-area {
    padding: 16px;
  }

  .two-col,
  .cv-header,
  .cv-body,
  .letter-header {
    grid-template-columns: 1fr;
  }

  .cv-header {
    padding: 24px;
  }

  .identity h2 {
    font-size: 34px;
  }

  .cv-body,
  .document-letter {
    padding: 24px;
  }

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

  .document-tabs,
  .action-row,
  .inline-actions {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

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

  .letter-meta {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  *,
  *::before,
  *::after {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    background: white;
  }

  .workspace-panel,
  .document-tabs,
  .preview-area {
    display: none;
  }

  .print-bundle {
    display: block;
    padding: 0;
  }

  .app-shell {
    display: none;
  }

  .print-page {
    width: 210mm;
    min-height: 297mm;
    background: white;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-cv-page {
    overflow: hidden;
    background:
      linear-gradient(90deg, var(--soft) 0 79mm, white 79mm 100%) !important;
  }

  .print-cv-hero {
    display: grid;
    grid-template-columns: 42mm 1fr;
    gap: 9mm;
    align-items: center;
    min-height: 54mm;
    padding: 10mm 12mm;
    color: white;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, black)) !important;
  }

  .print-photo {
    display: grid;
    place-items: center;
    width: 34mm;
    height: 44mm;
    overflow: hidden;
    border: 1.2mm solid var(--accent-2);
    border-radius: 2mm;
    font-weight: 900;
  }

  .print-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .print-cv-hero p {
    color: var(--accent-2);
    font-weight: 900;
    text-transform: uppercase;
  }

  .print-cv-hero h2 {
    margin-top: 2mm;
    font-size: 28pt;
    line-height: 1;
  }

  .print-cv-hero span {
    display: block;
    margin-top: 4mm;
    line-height: 1.45;
  }

  .print-cv-grid {
    display: grid;
    grid-template-columns: 68mm 1fr;
    gap: 9mm;
    padding: 9mm 11mm 12mm;
  }

  .print-sidebar {
    display: grid;
    align-content: start;
    gap: 6mm;
    padding-right: 0;
    border-right: 0.3mm solid var(--line);
  }

  .print-sidebar section {
    display: grid;
    gap: 2.2mm;
    justify-items: start;
    padding-right: 6mm;
    width: 100%;
  }

  .print-sidebar .print-personal {
    padding: 3mm 6mm 3mm 3mm;
    border-radius: 2mm 0 0 2mm;
    background: #eef2f5 !important;
    width: 100%;
  }

  .print-sidebar section,
  .print-section,
  .print-timeline-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-sidebar h3,
  .print-section h3 {
    margin: 0;
    color: var(--accent);
    font-size: 10pt;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .print-sidebar section > div:not(.print-chips) {
    color: var(--muted);
    line-height: 1.35;
  }

  .print-personal-list {
    display: grid;
    gap: 2mm;
    width: 100%;
  }

  .print-personal-list div {
    display: grid;
    gap: 0.8mm;
    width: 100%;
    padding: 0 0 2mm;
    border-bottom: 0.25mm solid color-mix(in srgb, var(--accent) 12%, #d9dee5);
  }

  .print-personal-list div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .print-personal-list span {
    display: block;
    color: var(--accent);
    font-size: 7.5pt;
    font-weight: 900;
    line-height: 1.1;
    text-transform: uppercase;
  }

  .print-personal-list strong {
    color: var(--ink);
    font-size: 9.2pt;
    font-weight: 750;
    line-height: 1.2;
    word-break: break-word;
  }

  .print-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 2mm;
    align-items: flex-start;
  }

  .print-chips span {
    display: inline-flex;
    align-items: center;
    padding: 1.6mm 2.3mm;
    border-radius: 999px;
    color: var(--accent);
    background: #eef2f5 !important;
    border: 0.25mm solid color-mix(in srgb, var(--accent) 12%, #d9dee5);
    font-size: 9pt;
    font-weight: 750;
    line-height: 1.1;
  }

  .print-main,
  .print-main-wide {
    display: grid;
    align-content: start;
    gap: 8mm;
  }

  .print-timeline {
    display: grid;
    gap: 5mm;
  }

  .print-timeline-item {
    display: grid;
    grid-template-columns: 30mm 1fr;
    gap: 5mm;
    padding-bottom: 4mm;
    border-bottom: 0.25mm solid var(--line);
  }

  .print-time {
    width: fit-content;
    height: fit-content;
    padding: 1.5mm 2mm;
    border-radius: 1.5mm;
    color: var(--accent);
    background: var(--soft) !important;
    font-weight: 900;
    font-size: 9pt;
  }

  .print-entry strong {
    display: block;
    margin-bottom: 2mm;
  }

  .print-entry ul {
    margin: 0;
    padding-left: 5mm;
    color: var(--muted);
  }

  .print-follow-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    padding: 10mm 12mm 8mm;
    color: white;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, black)) !important;
  }

  .print-follow-head p {
    color: var(--accent-2);
    font-weight: 900;
    text-transform: uppercase;
  }

  .print-follow-head h2 {
    font-size: 22pt;
  }

  .print-follow-head span {
    color: var(--accent-2);
    font-weight: 900;
  }

  .print-cv-grid-follow {
    padding-top: 9mm;
  }

  .print-sidebar-follow {
    min-height: 226mm;
  }

  .print-follow-note {
    padding-top: 1mm;
  }

  .print-follow-note div {
    font-weight: 800;
  }

  .print-main-wide {
    padding: 10mm 14mm;
  }

  .print-letter-page {
    padding: 46px 54px;
  }

  .letter-topline {
    background: linear-gradient(90deg, var(--accent), var(--accent-2)) !important;
  }

  .letter-badge {
    background: var(--accent) !important;
  }

}
