﻿:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --text: #1f2a2a;
  --muted: #64706f;
  --line: #dce3e1;
  --accent: #16736f;
  --accent-strong: #0f5652;
  --accent-soft: #dff0ee;
  --warn: #9a5b13;
  --bad: #b3261e;
  --wood: #d99c52;
  --wood-dark: #8b5a2b;
  --shadow: 0 18px 45px rgba(31, 42, 42, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 520px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  position: sticky;
  top: 20px;
  padding: 18px;
}

.brand {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-title {
  min-width: 0;
}

.brand-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.brand-qr {
  width: 92px;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.logo-mark {
  display: inline-grid;
  gap: 1px;
  margin-bottom: 8px;
  padding: 8px 12px 7px;
  border-radius: 6px;
  background: #202321;
  color: #f1bd8f;
  box-shadow: inset 0 0 0 1px rgba(241, 189, 143, 0.24);
  letter-spacing: 0;
  line-height: 1;
}

.logo-mark span {
  font-size: 24px;
  font-weight: 900;
}

.logo-mark small {
  color: #ffd5b2;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.brand-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.15;
}

.brand p,
.empty-state p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.45;
}

.icon-button,
.delete-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

#pdfButton {
  font-size: 11px;
  font-weight: 800;
}

.icon-button:hover,
.delete-button:hover,
.secondary-button:hover,
.small-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.35;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(22, 115, 111, 0.13);
}

.import-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 18px;
  background: #fbfdfc;
}

.import-block label + label {
  margin-top: 10px;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.hint {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.format-note {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.format-note strong {
  color: var(--text);
  font-size: 13px;
}

.hint.error-text {
  color: var(--bad);
}

.editor-block + .editor-block {
  margin-top: 18px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
}

h2 {
  font-size: 16px;
}

.small-button,
.secondary-button,
.primary-button {
  min-height: 38px;
  border-radius: 7px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.details-block .table-wrap {
  max-height: 430px;
  overflow: auto;
}

.details-block thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  background: #f8faf9;
}

th,
td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

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

td:last-child,
th:last-child {
  width: 44px;
  text-align: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.top-actions {
  margin-top: 0;
  margin-bottom: 18px;
}

.results {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  max-height: calc(100vh - 40px);
  position: sticky;
  top: 20px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}
.section-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.section-summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.section-summary-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.section-summary-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.metric strong {
  font-size: 24px;
}

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

.metric.wide-metric strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

#cutsPanel {
  padding: 18px;
  min-height: 0;
  overflow: auto;
}

.empty-state {
  min-height: 360px;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 24px;
}

.cut-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.cut-card:last-child {
  margin-bottom: 0;
}

.cut-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.cut-header strong {
  font-size: 17px;
}

.cut-header span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.bar {
  display: flex;
  width: 100%;
  height: 44px;
  border: 1px solid var(--wood-dark);
  border-radius: 7px;
  overflow: hidden;
  background: #f5eadb;
}

.piece,
.kerf,
.waste {
  min-width: 2px;
}

.piece {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e4b66d, var(--wood));
  border-right: 1px solid rgba(139, 90, 43, 0.35);
  color: #2f2115;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
}

.kerf {
  background: #2d3130;
}

.waste {
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(
    45deg,
    #f7f1e8,
    #f7f1e8 8px,
    #ebddca 8px,
    #ebddca 16px
  );
  color: var(--muted);
  font-size: 12px;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
}

.warning-box {
  border: 1px solid #e5ba78;
  background: #fff8ed;
  color: var(--warn);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.section-result {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.section-result:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.section-result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.section-result-header h2 {
  font-size: 18px;
}

.section-result-header span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.error-text {
  color: var(--bad);
  font-weight: 700;
}

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

  .controls {
    position: static;
  }

  .results {
    position: static;
    max-height: none;
  }

  #cutsPanel {
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .manual-header {
    grid-template-columns: 1fr;
  }

  .manual-page {
    padding: 12px;
  }

  .app-shell {
    padding: 12px;
  }

  .settings-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

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

  .brand,
  .cut-header {
    align-items: flex-start;
  }
}
@media print {
  body {
    background: #fff;
  }

  .controls,
  .actions,
  .icon-button {
    display: none;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .workspace {
    display: block;
  }

  .panel,
  .metric,
  .cut-card {
    box-shadow: none;
    break-inside: avoid;
  }
}





.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.manual-page {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.manual-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 0 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.manual-header p {
  margin-top: 6px;
  color: var(--muted);
}

.manual-back {
  min-width: 120px;
}

.manual-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 14px;
}

.manual-section h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

.manual-section p,
.manual-section li {
  line-height: 1.55;
}

.manual-section p + p,
.manual-section ul,
.manual-section ol {
  margin-top: 10px;
}

.manual-section ul,
.manual-section ol {
  padding-left: 22px;
}
