/* ---------- Editor de ficha técnica (prefixo fte-) ---------- */
.fte-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.fte-head h1 { margin-top: 2px; }
.fte-head p { margin-top: 4px; color: var(--tx-3); font-size: var(--fs-sm); }
.fte-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; }
.fte-dirty { border-color: var(--warn) !important; color: var(--warn) !important; }
.fte-progress { height: 3px; margin-bottom: var(--sp-4); overflow: hidden; border-radius: var(--r-pill); background: var(--s3); }
.fte-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--red); transition: width var(--t-med) var(--ease); }

.fte-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.fte-steps { position: sticky; top: var(--sp-4); display: grid; gap: 7px; }
.fte-steps > button { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) 16px; align-items: center; gap: 10px; padding: 11px 10px; text-align: left; color: var(--tx-3); border: 1px solid transparent; border-radius: var(--r-md); background: transparent; transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast); }
.fte-steps > button:hover { color: var(--tx); background: var(--s2); }
.fte-steps > button.on { color: var(--tx); border-color: var(--red-line); background: var(--red-soft); }
.fte-steps > button > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--tx-2); background: var(--s3); font: 600 var(--fs-xs) var(--mono); }
.fte-steps > button.on > span:first-child { color: var(--tx); background: var(--red); }
.fte-steps > button.done:not(.on) > span:first-child { color: var(--ok); background: var(--ok-soft); }
.fte-steps > button > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.fte-steps b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); font-weight: 600; }
.fte-steps small { color: var(--tx-4); font-size: var(--fs-2xs); }
.fte-steps svg { width: 15px; height: 15px; }
.fte-steps > button > svg { color: var(--tx-4); }

.fte-panel { min-width: 0; overflow: hidden; }
.fte-panel textarea.input { width: 100%; height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.fte-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.fte-section-head > div { min-width: 0; }
.fte-section-head span:first-child { color: var(--red-tx); font: 600 var(--fs-2xs) var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.fte-section-head h2 { margin-top: 3px; font-size: var(--fs-xl); }
.fte-section-head p { max-width: 65ch; margin-top: 4px; color: var(--tx-3); font-size: var(--fs-xs); line-height: 1.5; }
.fte-section-ic { width: 42px; height: 42px; display: grid; place-items: center; flex: none; border-radius: var(--r-md); color: var(--red-tx); background: var(--red-soft); }
.fte-section-ic svg { width: 20px; height: 20px; }

.fte-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 22px 24px; }
.fte-form-grid > div { min-width: 0; }
.fte-form-grid .input, .fte-form-grid .select { width: 100%; }
.fte-form-grid .input:disabled { opacity: .72; cursor: not-allowed; }
.fte-span-2 { grid-column: 1 / -1; }
.fte-version-field { position: relative; }
.fte-version-field span { position: absolute; right: 11px; top: 50%; translate: 0 -50%; color: var(--tx-4); font-size: var(--fs-2xs); pointer-events: none; }
.fte-form-spaced { padding-top: 4px; }
.fte-color-field { height: 42px; display: flex; align-items: center; gap: 10px; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--s2); }
.fte-color-field input { width: 32px; height: 28px; padding: 0; overflow: hidden; border: 0; border-radius: 7px; background: transparent; }
.fte-color-field span { color: var(--tx-3); font: var(--fs-xs) var(--mono); }

.fte-note { display: flex; align-items: flex-start; gap: 11px; margin: 0 24px 22px; padding: 13px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--s2); }
.fte-note.info { border-color: var(--info-soft); background: var(--info-soft); }
.fte-note.warn { margin: 16px 0 0; border-color: var(--warn-soft); background: var(--warn-soft); }
.fte-note > svg { width: 18px; height: 18px; flex: none; color: var(--info); }
.fte-note.warn > svg { color: var(--warn); }
.fte-note b { font-size: var(--fs-xs); }
.fte-note p { margin-top: 3px; color: var(--tx-3); font-size: var(--fs-xs); line-height: 1.5; }

.fte-image-layout { display: grid; grid-template-columns: minmax(290px, .9fr) minmax(380px, 1.1fr); gap: 16px; padding: 22px 24px; }
.fte-sketch-card { min-height: 420px; position: relative; overflow: hidden; display: grid; place-items: center; padding: 62px 16px 18px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: radial-gradient(circle at 50% 28%, var(--red-soft), transparent 45%), var(--s2); }
.fte-sketch-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 23px 23px; mask-image: linear-gradient(to bottom, var(--bg), transparent 85%); opacity: .7; }
.fte-sketch-card .prd-sketch { z-index: 1; }
.fte-sketch-top { position: absolute; z-index: 2; inset: 14px 14px auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fte-sketch-top > span:first-child { display: grid; gap: 2px; }
.fte-sketch-top b { font-size: var(--fs-xs); }
.fte-sketch-top small { color: var(--tx-4); font-size: var(--fs-2xs); }
.fte-image-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; }
.fte-image-card { min-height: 190px; display: grid; align-content: center; justify-items: center; gap: 9px; padding: 16px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--r-md); background: var(--bg-2); }
.fte-image-card.done { border-style: solid; border-color: var(--ok-soft); background: linear-gradient(145deg, var(--ok-soft), var(--bg-2)); }
.fte-image-card input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.fte-image-card > div { min-width: 0; display: grid; gap: 3px; }
.fte-image-card b { font-size: var(--fs-xs); }
.fte-image-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tx-4); font-size: var(--fs-2xs); }
.fte-image-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--tx-3); background: var(--s3); }
.fte-image-card.done .fte-image-icon { color: var(--ok); background: var(--ok-soft); }
.fte-image-icon svg { width: 20px; height: 20px; }

.fte-size-picker { display: grid; gap: 12px; padding: 22px 24px 14px; }
.fte-size-picker > div:first-child { display: grid; gap: 2px; }
.fte-size-picker b { font-size: var(--fs-sm); }
.fte-size-picker small { color: var(--tx-4); font-size: var(--fs-xs); }
.fte-size-picker > div:last-child { display: flex; flex-wrap: wrap; gap: 7px; }
.fte-size-picker button { min-width: 42px; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 9px; color: var(--tx-3); background: var(--s2); font: 600 var(--fs-xs) var(--mono); }
.fte-size-picker button.on { color: var(--tx); border-color: var(--red-line); background: var(--red-soft); }
.fte-measure-wrap { overflow-x: auto; padding: 0 24px 14px; }
.fte-measure-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0 7px; }
.fte-measure-table th { padding: 0 6px 5px; color: var(--tx-4); font-size: var(--fs-2xs); font-weight: 500; text-align: center; text-transform: uppercase; letter-spacing: .05em; }
.fte-measure-table th:first-child { text-align: left; }
.fte-measure-table td { padding: 6px; background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fte-measure-table td:first-child { border-left: 1px solid var(--line); border-radius: var(--r-sm) 0 0 var(--r-sm); }
.fte-measure-table td:last-child { border-right: 1px solid var(--line); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.fte-measure-table .input { min-width: 66px; width: 100%; height: 36px; padding: 0 8px; text-align: center; }
.fte-measure-name { min-width: 250px; display: grid; grid-template-columns: 55px minmax(170px, 1fr); gap: 6px; }
.fte-measure-name .input:last-child { text-align: left; }
.fte-measure-table + * { margin-left: 24px; }
#fte-add-measure { margin: 0 24px 22px; }

.fte-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 24px 12px; }
.fte-list-head > div { display: grid; gap: 2px; }
.fte-list-head b { font-size: var(--fs-sm); }
.fte-list-head small { color: var(--tx-4); font-size: var(--fs-xs); }
.fte-edit-list, .fte-route-list { display: grid; gap: 8px; padding: 0 24px 22px; }
.fte-edit-list > div, .fte-route-list > div { display: grid; grid-template-columns: 38px minmax(0, 1fr) 36px; align-items: center; gap: 8px; }
.fte-list-index, .fte-route-number { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: var(--red-tx); background: var(--red-soft); font: 600 var(--fs-2xs) var(--mono); }
.fte-route-list > div { grid-template-columns: 32px 18px minmax(0, 1fr) 36px; }
.fte-route-grip { color: var(--tx-4); }
.fte-route-grip svg { width: 15px; height: 15px; }

.fte-review-hero { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 20px; margin: 22px 24px 16px; padding: 18px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: linear-gradient(145deg, var(--s2), var(--bg-2)); }
.fte-review-art { min-height: 170px; display: grid; place-items: center; overflow: hidden; border-radius: var(--r-sm); background: radial-gradient(circle, var(--red-soft), transparent 65%), var(--s3); }
.fte-review-art .prd-sketch { width: 150px; max-height: 165px; }
.fte-review-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.fte-review-hero h3 { font-size: var(--fs-xl); }
.fte-review-hero p { margin-top: 4px; color: var(--tx-3); font-size: var(--fs-xs); }
.fte-review-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.fte-review-meta span { min-width: 0; display: grid; gap: 3px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--s1); }
.fte-review-meta small { color: var(--tx-4); font-size: var(--fs-2xs); }
.fte-review-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); }
.fte-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 24px 22px; }
.fte-review-grid > article { padding: 16px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--bg-2); }
.fte-review-grid h4 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.fte-review-grid h4 svg { width: 17px; height: 17px; color: var(--info); }
.fte-complete-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.fte-complete-head > span { display: grid; gap: 2px; }
.fte-complete-head b { font-size: var(--fs-sm); }
.fte-complete-head small { color: var(--tx-4); font-size: var(--fs-xs); }
.fte-complete-head strong { color: var(--red-tx); font: 700 var(--fs-xl) var(--mono); }
.fte-check-list, .fte-safety-list { display: grid; gap: 7px; margin: 14px 0 0; padding: 0; list-style: none; }
.fte-check-list li { display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 8px; padding: 8px 9px; border-radius: var(--r-sm); color: var(--tx-3); background: var(--s2); }
.fte-check-list li.done { color: var(--tx-2); }
.fte-check-list li > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: var(--warn); background: var(--warn-soft); }
.fte-check-list li.done > span { color: var(--ok); background: var(--ok-soft); }
.fte-check-list svg { width: 14px; height: 14px; }
.fte-check-list b { font-size: var(--fs-xs); font-weight: 500; }
.fte-check-list button { color: var(--info); font-size: var(--fs-2xs); background: transparent; }
.fte-safety-list li { display: flex; align-items: flex-start; gap: 8px; color: var(--tx-2); font-size: var(--fs-xs); line-height: 1.45; }
.fte-safety-list svg { width: 15px; height: 15px; flex: none; color: var(--ok); }

.fte-footer { display: flex; align-items: center; gap: 10px; padding: 15px 24px; border-top: 1px solid var(--line); background: var(--s1); }
.fte-footer > span { flex: 1; text-align: center; color: var(--tx-4); font: var(--fs-2xs) var(--mono); }
.fte-footer .btn:disabled { opacity: .35; cursor: not-allowed; }

@media (max-width: 1120px) {
  .fte-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .fte-image-layout { grid-template-columns: 1fr; }
  .fte-sketch-card { min-height: 380px; }
  .fte-review-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .fte-head { align-items: stretch; flex-direction: column; }
  .fte-head-actions { justify-content: flex-start; }
  .fte-shell { grid-template-columns: 1fr; }
  .fte-steps { position: static; grid-template-columns: repeat(6, minmax(54px, 1fr)); overflow-x: auto; padding-bottom: 3px; }
  .fte-steps > button { min-width: 58px; display: grid; grid-template-columns: 1fr; justify-items: center; padding: 8px 6px; text-align: center; }
  .fte-steps > button > span:nth-child(2) b { font-size: 10px; }
  .fte-steps > button > span:nth-child(2) small, .fte-steps > button > svg { display: none; }
  .fte-form-grid { grid-template-columns: 1fr; }
  .fte-span-2 { grid-column: auto; }
  .fte-review-hero { grid-template-columns: 1fr; }
  .fte-review-meta { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .fte-section-head, .fte-form-grid, .fte-image-layout { padding-left: 16px; padding-right: 16px; }
  .fte-section-ic { display: none; }
  .fte-note { margin-left: 16px; margin-right: 16px; }
  .fte-image-grid { grid-template-columns: 1fr; }
  .fte-image-card { min-height: 150px; }
  .fte-list-head, .fte-edit-list, .fte-route-list, .fte-review-grid { padding-left: 16px; padding-right: 16px; }
  .fte-list-head { align-items: flex-start; flex-direction: column; }
  .fte-review-hero { margin-left: 16px; margin-right: 16px; }
  .fte-footer { position: sticky; bottom: 0; z-index: 4; padding: 12px 16px; }
  .fte-footer > span { display: none; }
  .fte-footer .btn { flex: 1; padding-inline: 10px; }
}

/* ---------- Ficha completa (8 etapas): listas editáveis, BOM, aplicações, cartela e prévia ---------- */
.fte-hint { display: block; margin-top: 5px; color: var(--tx-4); font-size: var(--fs-2xs); line-height: 1.4; }
.fte-sub-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 4px 24px 0; }
.fte-sub-head b { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); }
.fte-sub-head svg { width: 15px; height: 15px; color: var(--info); }
.fte-sub-head small { color: var(--tx-4); font-size: var(--fs-xs); }
.fte-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 12px; }
.fte-empty { color: var(--tx-4); font-size: var(--fs-xs); padding: 6px 0; }
.fte-pad { padding: 0 24px 18px; }
.fte-flush { padding-left: 0; padding-right: 0; }
.fte-flush-x { padding-left: 0; padding-right: 0; }
.fte-edit-list.fte-pairs > div { grid-template-columns: 38px minmax(0, 1fr) minmax(0, 2fr) 36px; }
.fte-bom { display: grid; gap: 8px; padding: 0 24px 22px; }
.fte-bom > div { display: grid; grid-template-columns: 38px minmax(0, 1.1fr) minmax(0, 2.2fr) minmax(0, 1.1fr) 36px; align-items: center; gap: 8px; }
.fte-inline-actions { padding: 0 24px 18px; }
.fte-panel .input, .fte-panel .select { min-width: 0; }

.fte-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; position: relative; z-index: 1; }
.fte-preview.one { grid-template-columns: 1fr; }
.fte-preview figure { margin: 0; display: grid; justify-items: center; gap: 6px; }
.fte-preview .prd-sketch { width: 100%; max-width: 300px; filter: none; }
.fte-preview figcaption { color: var(--tx-3); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; }

.fte-points { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; margin: 0 24px 6px; padding: 16px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--bg-2); }
.fte-points .fte-preview { padding: 10px; border-radius: var(--r-sm); background: radial-gradient(circle at 50% 30%, var(--red-soft), transparent 55%), var(--s3); }
.fte-points__how { display: grid; gap: 10px; }
.fte-how { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 10px; align-items: start; }
.fte-how > span:last-child { display: grid; gap: 5px; }
.fte-how b { font-size: var(--fs-xs); }
.fte-how .input { width: 100%; }

.fte-image-card { position: relative; }
.fte-image-card img { width: 100%; max-height: 150px; object-fit: contain; border-radius: var(--r-sm); background: var(--s3); }
.fte-image-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.fte-pers-layout { display: grid; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); gap: 16px; padding: 22px 24px; align-items: start; }
.fte-pers-layout .fte-list-head, .fte-pers-layout .fte-edit-list { padding-left: 0; padding-right: 0; }
.fte-pers-layout .fte-form-grid { padding-top: 0; }
.fte-sticky { position: sticky; top: 12px; min-height: 0; padding: 56px 12px 14px; }
.fte-aps { display: grid; gap: 12px; padding-bottom: 18px; }
.fte-ap { border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--bg-2); overflow: hidden; }
.fte-ap header { display: grid; grid-template-columns: 38px minmax(0, 1fr) 36px; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--s2); }
.fte-ap__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.fte-ap__grid .fte-c2 { grid-column: span 2; }
.fte-ap__grid textarea.input, .fte-bom textarea.input { min-height: 0; height: auto; padding: 8px 12px; resize: vertical; line-height: 1.45; }
.fte-bom > div { align-items: start; }
.fte-ap__grid .input, .fte-ap__grid .select { width: 100%; }
.fte-ap__grid .fte-span-2 { grid-column: 1 / -1; }
.fte-colors { display: grid; gap: 8px; padding-bottom: 18px; }
.fte-colors > div { display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.fte-colors input[type="color"] { width: 42px; height: 38px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--s2); }
.fte-add-tec { display: flex; gap: 8px; align-items: center; }
.fte-add-tec .select { height: 32px; font-size: var(--fs-xs); }
.fte-tec { margin-bottom: 12px; padding: 12px 12px 0; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--bg-2); }
.fte-tec__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fte-tec__head b { color: var(--red-tx); font-size: var(--fs-sm); }
.fte-tec__head > span { display: flex; gap: 6px; align-items: center; }
.fte-tec .fte-edit-list { padding: 0 0 12px; }
.fte-pdf-btn { margin-top: 14px; }

@media (max-width: 1120px) {
  .fte-pers-layout { grid-template-columns: 1fr; }
  .fte-sticky { position: static; }
  .fte-points { grid-template-columns: 1fr; }
  .fte-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .fte-steps { grid-template-columns: repeat(8, minmax(54px, 1fr)); }
  .fte-bom > div { grid-template-columns: 32px minmax(0, 1fr) 36px; }
  .fte-bom > div > input:nth-of-type(2), .fte-bom > div > input:nth-of-type(3) { grid-column: 2; }
  .fte-edit-list.fte-pairs > div { grid-template-columns: 32px minmax(0, 1fr) 36px; }
  .fte-edit-list.fte-pairs > div > input:nth-of-type(2) { grid-column: 2; }
}
@media (max-width: 600px) {
  .fte-grid-4, .fte-ap__grid { grid-template-columns: 1fr; }
  .fte-ap__grid .fte-c2 { grid-column: auto; }
  .fte-bom, .fte-inline-actions, .fte-pad, .fte-sub-head { padding-left: 16px; padding-right: 16px; }
  .fte-points, .fte-pers-layout { margin-left: 16px; margin-right: 16px; padding: 12px; }
  .fte-pers-layout { margin: 0; padding: 16px; }
  .fte-colors > div { grid-template-columns: 42px minmax(0, 1fr) 36px; }
  .fte-colors > div > input:nth-of-type(3) { grid-column: 2; }
}
