:root {
  --bg: #f3f7fc;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --line: #d9e4f2;
  --text: #1c2a39;
  --muted: #6a7a90;
  --blue: #1f73f1;
  --blue-dark: #165cc2;
  --danger: #d14343;
  --danger-bg: #fff3f3;
  --shadow: 0 12px 30px rgba(20, 71, 145, 0.08);
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family:"Montserrat","Roboto","Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,sans-serif;
  background:rgb(255, 249, 242);
  color:var(--text);
}

button,
input {
  font: inherit;
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.app-header__eyebrow {
  margin: 0 0 8px;
  color: rgb(114, 95, 88);
  font-size: 14px;
  font-weight: 700;
}

.app-header__title {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.1;
  font-weight:700;
  letter-spacing:0.02em;
  color: rgb(45, 27, 16);
}

.app-header__subtitle {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-weight:500;
}

.app-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px; /* было 10px */
  justify-content: flex-end;
}

.app-header__actions .btn {
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(31, 115, 241, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel--form,
.panel--preview {
  padding: 20px;
  background: rgb(255, 249, 242);
}

.panel--preview {
  position: sticky;
  top: 20px;
}

.goals {
  display: grid;
  gap: 16px;
}

.goal-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255, 249, 242);
  padding: 18px;
}

.goal-card--invalid {
  border-color: #efb3b3;
}

.goal-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.goal-card__index {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.goal-card__title {
  margin: 0;
  font-size: 20px;
}

.goal-card__remove {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--danger);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field--full {
  grid-column: 1 / -1;
}

.field__label {
  color: var(--muted);
  font-size: 14px;
}

.field__input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgb(255, 255, 255);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(31, 115, 241, 0.12);
}

.field__input--error {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.field__hint {
  color: var(--muted);
  font-size: 12px;
}

.field__error {
  min-height: 16px;
  color: var(--danger);
  font-size: 12px;
}

.goal-meta {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.goal-meta__item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.goal-meta__label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.goal-meta__value {
  font-size: 18px;
}

.controls {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.controls__hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.preview-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.preview-header p {
  margin: 0 0 16px;
  color: var(--muted);
}

.preview-empty {
  padding: 24px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: #fbfdff;
  color: var(--muted);
}

.preview-content.hidden {
  display: none;
}

.pdf-export-area {
  background: #fff;
}

.pdf-export-head {
  margin-bottom: 14px;
}

.pdf-export-head h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.pdf-export-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  overflow: hidden;
  border-radius: 14px;
}

.results-table th,
.results-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e8eef7;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.results-table th {
  background: #f5f9ff;
  color: var(--muted);
  font-weight: 700;
}

.results-table tfoot td {
  background: #f3f8ff;
  font-weight: 700;
  border-bottom: 0;
}

.result-row--error td {
  color: var(--danger);
}

.btn{
  min-height:40px;
  padding:0 18px;
  border-radius:999px;            /* «пилюля» */
  border:1px solid transparent;
  cursor:pointer;
  font-weight:600;
  font-size:14px;
  line-height:1;
  transition:background-color .15s ease,
             color .15s ease,
             box-shadow .15s ease,
             border-color .15s ease;
}


/* Уменьшенные кнопки в шапке на 30% 4 абзаца*/
.app-header__actions .btn {
  min-height: 31px;
  padding: 0 11px;
  font-size: 14px;
  border-radius: 999px;
}

.btn--primary {
  background: rgb(75, 54, 33);
  border-color: rgb(75, 54, 33);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
}

.btn--primary:hover {
  background: rgb(65, 46, 28);
  border-color: rgb(65, 46, 28);
}

.btn--secondary {
  background:#ffffff;
  border-color:#d0d7e5;
  color:#1c2a39;
}

.btn--secondary:hover{
  background:#f3f5fb;
}

.btn--ghost {
  background:#f4f6fb;
  border-color:#d0d7e5;
  color:#1c2a39;
}

.btn--secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn--ghost {
  background: #f5f9ff;
  color: var(--blue-dark);
  border: 1px solid #d7e6ff;
}

@media print {
  .app-header__actions,
  .controls,
  .goal-card__remove {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    box-shadow: none;
    border: 1px solid #d9d9d9;
  }
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel--preview {
    position: static;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 16px;
  }

  .app-header,
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .goal-grid,
  .goal-meta {
    grid-template-columns: 1fr;
  }

  .app-header__title {
    font-size: 28px;
  }
}
.preview-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-start;
}

.preview-actions .btn,
#pdfBtn {
  background: rgb(75, 54, 33);
  border-color: rgb(75, 54, 33);
  color: #ffffff;
}

.goal-card__title,
.preview-header h2,
.pdf-export-head h3,
.results-table tfoot td,
.preview-actions .btn {
  color: rgb(45, 27, 16);
}