:root {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #607086;
  --line: #d8e1ec;
  --blue: #1f6feb;
  --blue-dark: #1754b8;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --shadow: 0 12px 34px rgba(21, 35, 61, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.35;
}

button, input, textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover, .ghost-link:hover {
  border-color: #9ab5d4;
  box-shadow: 0 8px 20px rgba(31, 111, 235, .12);
}

button:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.app {
  max-width: 1720px;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.brand b {
  display: block;
  font-size: 22px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  background: #fff;
}

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

.work-stack {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
  gap: 18px;
  grid-column: 1;
  align-items: start;
}

.work-stack .upload-grid {
  grid-template-columns: 1fr;
}

.work-stack .drop-zone {
  min-height: 145px;
}

.work-panel, .side-panel > section, .result-panel, .basket-panel, .pdf-panel, .stock-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.work-panel, .settings-card, .result-panel, .converter-panel, .basket-panel, .pdf-panel, .stock-panel {
  padding: 18px;
}

.converter-panel {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.pdf-panel {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-color: #bbf7d0;
}

.work-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border-color: #cfe0f3;
}

.stock-panel {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  border-color: #fde68a;
}

.settings-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f7ff 100%);
  border-color: #ddd6fe;
}

.result-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  border-color: #99f6e4;
}

.basket-panel {
  background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
  border-color: #fed7aa;
}

.step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.step-head > span {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f1ff;
  color: var(--blue-dark);
  font-weight: 900;
}

.step-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.converter-panel .step-icon {
  background: #dbeafe;
  color: #1d4ed8;
}

.pdf-panel .step-icon {
  background: #dcfce7;
  color: #15803d;
}

.work-panel .step-icon {
  background: #e0f2fe;
  color: #0369a1;
}

.stock-panel .step-icon {
  background: #fef3c7;
  color: #b45309;
}

.settings-card .step-icon {
  background: #ede9fe;
  color: #5b21b6;
}

.result-panel .step-icon {
  background: #ccfbf1;
  color: #0f766e;
}

.basket-panel .step-icon {
  background: #ffedd5;
  color: #c2410c;
}

.step-head h1, .step-head h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
}

.step-head.compact h2 {
  font-size: 21px;
}

.step-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(320px, 1.2fr);
  gap: 14px;
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.1fr) 230px;
  gap: 14px;
  align-items: stretch;
}

.pdf-upload-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 260px;
  gap: 14px;
  align-items: stretch;
}

.drop-zone {
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 2px dashed #a9bdd5;
  border-radius: 10px;
  background: #f8fbff;
  text-align: center;
  cursor: pointer;
}

.compact-zone {
  min-height: 150px;
}

.pdf-zone {
  min-height: 150px;
  background: #f7fbf8;
  border-color: #9cc8ad;
}

.stock-zone {
  background: #fbfbf7;
  border-color: #c8bd8e;
}

.drop-zone input, .mini-upload input {
  display: none;
}

.drop-zone b {
  font-size: 19px;
}

.drop-zone small {
  color: var(--muted);
}

.drop-zone.drag-active {
  border-color: var(--blue);
  background: #eaf3ff;
  box-shadow: 0 0 0 4px rgba(31, 111, 235, .12);
}

.drop-hint {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
}

.drop-file-name {
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  background: #dbeafe;
  color: #174c91;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paste-box {
  display: grid;
  gap: 8px;
}

.converter-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}

.pdf-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}

.pdf-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #b9dac5;
  background: #f3fbf5;
  color: #315c3e;
  font-size: 13px;
  font-weight: 700;
}

.paste-box label, .settings-card label, .field > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 118px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

.summary-strip, .result-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.material-search-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, .9fr) auto;
  gap: 10px;
  align-items: end;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.material-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.part-lock-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.part-lock-actions span {
  flex: 1 1 280px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.part-lock-actions button {
  min-height: 38px;
  padding: 8px 10px;
}

.material-chips {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-height: 168px;
  overflow: auto;
}

.material-chips button {
  display: grid;
  gap: 2px;
  min-width: 150px;
  text-align: left;
  padding: 9px 10px;
}

.material-chips button.active {
  background: #e8f1ff;
  border-color: var(--blue);
}

.material-chips span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.summary-strip div, .result-metrics div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.summary-strip span, .result-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-strip b, .result-metrics b {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.part-table-wrap {
  max-height: 420px;
}

.stock-table-wrap {
  max-height: 420px;
  margin-top: 12px;
}

.part-table-wrap thead th,
.stock-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef4fb;
  color: #314158;
  font-size: 12px;
  text-transform: uppercase;
}

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

.splice-select {
  width: 100%;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.manual-splice-tag {
  display: block;
  margin-top: 6px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
}

.settings-card {
  display: grid;
  gap: 14px;
}

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

.field {
  display: grid;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented button {
  padding: 9px 8px;
}

.segmented .active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.calc-mode-options, .cut-mode-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.calc-mode-option, .cut-mode-option {
  display: grid !important;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
}

.calc-mode-option:has(input:checked), .cut-mode-option:has(input:checked) {
  border-color: #1f6feb;
  background: #eff6ff;
  box-shadow: inset 3px 0 0 #1f6feb;
}

.calc-mode-option input, .cut-mode-option input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.calc-mode-option b,
.calc-mode-option small,
.cut-mode-option b,
.cut-mode-option small {
  display: block;
}

.calc-mode-option small, .cut-mode-option small {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
}


.cut-mode-options.locked-safe + .field-hint {
  color: #92400e;
}

.cut-mode-options.locked-economic + .field-hint {
  color: #166534;
}

.splice-panel {
  display: grid;
  gap: 8px;
}

.splice-toggle {
  margin: 0;
}

.splice-limit {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.splice-limit .check-row {
  margin: 0;
}

.splice-guard-toggle {
  font-weight: 800;
}

.splice-auto-toggle {
  font-weight: 800;
  color: var(--primary);
}


.splice-mode-note {
  padding: 8px 10px;
  border-radius: 7px;
  background: #f7fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.splice-auto-hint {
  padding: 8px 10px;
  border-radius: 7px;
  background: #eef6ff;
  color: #24496d;
  font-size: 12px;
  line-height: 1.4;
}

.info-tooltip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  margin-left: auto;
  border: 1px solid #8db9e2;
  border-radius: 50%;
  background: #fff;
  color: #1f5f99;
  font-size: 12px;
  font-weight: 900;
  cursor: help;
}

.info-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 30;
  right: 0;
  bottom: calc(100% + 8px);
  width: 280px;
  padding: 9px 10px;
  border-radius: 7px;
  background: #173b5e;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(15, 45, 75, .22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: .15s ease;
}

.info-tooltip:hover::after,
.info-tooltip:focus::after {
  opacity: 1;
  transform: translateY(0);
}

.splice-override-box {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #fdba74;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
}

.splice-override-box p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

.splice-override-box button {
  border-color: #c2410c;
  background: #c2410c;
  color: #fff;
  font-weight: 800;
}

.splice-override-box.approved {
  border-color: #f59e0b;
  background: #fffbeb;
}

.splice-help {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.field-hint {
  margin: -4px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.stock-area {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.length-warning {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.35;
}

.length-warning.warn {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: var(--amber);
}

.length-warning.error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: var(--red);
}

.mini-upload {
  display: block;
  padding: 10px 12px;
  border: 1px dashed #9ab5d4;
  border-radius: 8px;
  text-align: center;
  background: #fff;
  cursor: pointer;
}

.stock-count {
  color: var(--muted);
  font-size: 13px;
}

.stock-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.template-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid #9ab5d4;
  background: #fff;
  color: var(--blue-dark);
  font-weight: 900;
  text-decoration: none;
}

.template-link:hover {
  background: #edf5ff;
}

.primary-action {
  min-height: 48px;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-size: 16px;
}

.primary-action:hover {
  background: var(--blue-dark);
}

.status {
  min-height: 44px;
  max-height: 150px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--green);
}

.status.warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: var(--amber);
}

.status.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--red);
}

.result-panel, .basket-panel {
  grid-column: 1 / -1;
}

.result-metrics {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  margin-bottom: 16px;
}

.decision-notes {
  margin: -4px 0 14px;
}

.learning-panel {
  margin: -2px 0 14px;
}

.learning-group {
  border: 1px solid #bdd7ee;
  border-radius: 8px;
  background: #f7fbff;
  overflow: hidden;
}

.learning-group summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.learning-group summary::-webkit-details-marker {
  display: none;
}

.learning-group summary::before {
  content: "+";
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #dbeafe;
  color: var(--blue-dark);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.learning-group[open] summary::before {
  content: "-";
}

.learning-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.learning-title b {
  font-size: 14px;
}

.learning-title small,
.learning-body p,
.learning-card small,
.learning-card em {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.learning-body {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid #d7e6f5;
  background: #fbfdff;
}

.learning-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 8px;
}

.learning-card {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 86px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  appearance: none;
  color: inherit;
  font: inherit;
  text-align: left;
}

.learning-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.learning-card b {
  color: var(--ink);
  font-size: 20px;
}

.learning-card em {
  font-style: normal;
}

.learning-card.selectable {
  cursor: pointer;
}

.learning-card.selectable:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(31, 111, 229, .12);
}

.learning-card.active {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(31, 111, 229, .2);
}

.learning-card.disabled {
  cursor: not-allowed;
  opacity: .72;
}

.learning-card strong {
  justify-self: start;
  margin-top: 2px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e8f1ff;
  color: var(--blue-dark);
  font-size: 11px;
  line-height: 1;
}

.learning-card.better {
  border-color: #86efac;
  background: #f0fdf4;
}

.learning-card.same {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.learning-card.worse {
  border-color: #fde68a;
  background: #fffbeb;
}

.calc-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calc-history-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  appearance: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.calc-history-button:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(31, 111, 229, .1);
}

.calc-history-button.active {
  border-color: var(--blue);
  background: #eff6ff;
}

.calc-history-button b {
  font-size: 12px;
}

.calc-history-button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.decision-notes-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.decision-notes-group summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.decision-notes-group summary::-webkit-details-marker {
  display: none;
}

.decision-notes-group summary::before {
  content: "+";
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #e8f1ff;
  color: var(--blue-dark);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.decision-notes-group[open] summary::before {
  content: "-";
}

.decision-summary-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.decision-summary-main b,
.decision-note b {
  font-size: 13px;
}

.decision-summary-main small,
.decision-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.decision-summary-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-summary-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 42%;
}

.decision-badge {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.decision-notes-body {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.decision-note {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.decision-note.ok,
.decision-badge.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.decision-note.warn,
.decision-badge.warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.decision-note.error,
.decision-badge.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.decision-badge.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--blue-dark);
}

.manual-splice-panel {
  display: grid;
  gap: 10px;
  margin: -4px 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.manual-splice-group {
  border: 1px solid #b7cce6;
  border-radius: 8px;
  background: #f7fbff;
  overflow: hidden;
}

.manual-splice-group summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.manual-splice-group summary::-webkit-details-marker {
  display: none;
}

.manual-splice-group summary::before {
  content: "+";
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #e8f1ff;
  color: var(--blue-dark);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.manual-splice-group[open] summary::before {
  content: "-";
}

.manual-splice-body {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding: 10px;
  border-top: 1px solid #cfe0f3;
  background: #f8fbff;
}

.manual-splice-help {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid #cfe0f3;
  border-radius: 8px;
  background: #fff;
}

.manual-splice-help p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.manual-splice-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.manual-splice-head h3 {
  margin: 0;
  font-size: 17px;
}

.manual-splice-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.manual-splice-head > span {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: #e8f1ff;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.manual-splice-row {
  display: grid;
  grid-template-columns: minmax(210px, .9fr) minmax(260px, 1fr) minmax(300px, .85fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.manual-splice-row b,
.manual-splice-row span {
  display: block;
}

.manual-splice-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.manual-splice-controls {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto auto;
  gap: 8px;
}

.manual-splice-preview {
  display: grid;
  gap: 5px;
}

.manual-preview-empty,
.manual-preview-error {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.manual-preview-empty {
  border: 1px dashed #b7cce6;
  background: #fbfdff;
  color: var(--muted);
}

.manual-preview-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: var(--red);
}

.manual-cut-visual {
  display: flex;
  align-items: stretch;
  min-height: 32px;
  overflow: hidden;
  border: 1px solid #9ab5d4;
  border-radius: 8px;
  background: #e8f1ff;
}

.manual-cut-visual span {
  display: grid;
  place-items: center;
  min-width: 54px;
  margin: 0;
  background: #1f6feb;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.manual-cut-visual i {
  display: grid;
  place-items: center;
  width: 42px;
  flex: 0 0 42px;
  background: #fffbeb;
  color: var(--amber);
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  border-left: 1px solid #9ab5d4;
  border-right: 1px solid #9ab5d4;
}

.manual-splice-preview small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calc-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
}

.calc-card {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 20px;
  align-items: center;
  padding: 22px;
  border: 1px solid #c7d6e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(15,23,42,.25);
}

.calc-card h2 {
  margin: 0 0 8px;
}

.calc-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.calc-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.calc-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf6;
}

.calc-progress span {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f6feb, #22c55e);
  transition: width .35s ease;
}

.calc-illustration {
  position: relative;
  height: 170px;
  border: 1px solid #d9e4f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 58%, #e1ebf6 58%, #e1ebf6 100%);
  overflow: hidden;
}

.desk-scene {
  position: absolute;
  inset: 0;
}

.stress-lines {
  position: absolute;
  left: 18px;
  top: 14px;
  z-index: 4;
  display: flex;
  gap: 8px;
  font-weight: 900;
  color: #b91c1c;
}

.stress-lines span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #26364d;
  border-radius: 50%;
  background: #fff7ed;
  animation: stressPop 1.15s ease-in-out infinite;
}

.stress-lines span:nth-child(2) {
  animation-delay: .18s;
}

.stress-lines span:nth-child(3) {
  animation-delay: .34s;
}

.worker {
  position: absolute;
  left: 24px;
  bottom: 30px;
  width: 76px;
  height: 106px;
  animation: stressBob 1.05s ease-in-out infinite;
}

.worker-head {
  position: absolute;
  left: 21px;
  top: 8px;
  width: 42px;
  height: 42px;
  border: 2px solid #26364d;
  border-radius: 50%;
  background: #ffd7b5;
  box-shadow: inset 0 8px 0 #26364d;
}

.worker-head::before,
.worker-head::after {
  content: "";
  position: absolute;
  top: 22px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #26364d;
}

.worker-head::before {
  left: 11px;
}

.worker-head::after {
  right: 11px;
}

.worker-head i {
  position: absolute;
  right: -9px;
  top: 13px;
  width: 8px;
  height: 14px;
  border-radius: 999px;
  background: #38bdf8;
  transform: rotate(16deg);
  animation: sweatDrop 1.2s ease-in-out infinite;
}

.worker-body {
  position: absolute;
  left: 13px;
  top: 50px;
  width: 54px;
  height: 50px;
  border: 2px solid #26364d;
  border-radius: 16px 16px 8px 8px;
  background: #1f6feb;
}

.worker-arm {
  position: absolute;
  top: 76px;
  width: 42px;
  height: 10px;
  border: 2px solid #26364d;
  border-radius: 999px;
  background: #ffd7b5;
  transform-origin: 7px 5px;
}

.worker-arm-left {
  left: 4px;
  transform: rotate(18deg);
  animation: typingLeft .42s ease-in-out infinite;
}

.worker-arm-right {
  left: 37px;
  transform: rotate(-14deg);
  animation: typingRight .42s ease-in-out infinite;
}

.monitor {
  position: absolute;
  right: 20px;
  bottom: 56px;
  width: 84px;
  height: 66px;
  border: 3px solid #26364d;
  border-radius: 8px;
  background: #102a43;
  box-shadow: 0 10px 20px rgba(15,23,42,.12);
}

.monitor::before {
  content: "";
  position: absolute;
  left: 35px;
  bottom: -20px;
  width: 12px;
  height: 18px;
  border: 2px solid #26364d;
  background: #94a3b8;
}

.monitor::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: -27px;
  width: 42px;
  height: 8px;
  border: 2px solid #26364d;
  border-radius: 8px 8px 2px 2px;
  background: #64748b;
}

.screen-lines {
  position: absolute;
  inset: 11px;
  display: grid;
  gap: 7px;
}

.screen-lines span {
  height: 7px;
  border-radius: 999px;
  background: #8bd3ff;
  animation: screenBlink 1.1s ease-in-out infinite;
}

.screen-lines span:nth-child(1) {
  width: 88%;
}

.screen-lines span:nth-child(2) {
  width: 58%;
  animation-delay: .18s;
}

.screen-lines span:nth-child(3) {
  width: 78%;
  animation-delay: .34s;
}

.keyboard {
  position: absolute;
  right: 48px;
  bottom: 31px;
  width: 78px;
  height: 16px;
  border: 2px solid #26364d;
  border-radius: 5px;
  background: repeating-linear-gradient(90deg, #dbeafe 0 8px, #bfdbfe 8px 12px);
  transform: skewX(-9deg);
}

.paper-stack {
  position: absolute;
  left: 12px;
  bottom: 17px;
  width: 52px;
  height: 28px;
}

.paper-stack::before,
.paper-stack span {
  content: "";
  position: absolute;
  width: 42px;
  height: 22px;
  border: 2px solid #26364d;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 6px 10px rgba(15,23,42,.09);
}

.paper-stack::before {
  left: 4px;
  top: 5px;
  transform: rotate(-5deg);
}

.paper-stack span:nth-child(1) {
  left: 9px;
  top: 0;
  transform: rotate(6deg);
  animation: paperWobble 1.3s ease-in-out infinite;
}

.paper-stack span:nth-child(2) {
  left: 0;
  top: 11px;
  transform: rotate(2deg);
}

.coffee-cup {
  position: absolute;
  right: 16px;
  bottom: 17px;
  width: 24px;
  height: 22px;
  border: 2px solid #26364d;
  border-radius: 0 0 7px 7px;
  background: #f97316;
}

.coffee-cup::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 4px;
  width: 9px;
  height: 10px;
  border: 2px solid #26364d;
  border-left: 0;
  border-radius: 0 9px 9px 0;
}

.coffee-cup span,
.coffee-cup span::before {
  content: "";
  position: absolute;
  top: -18px;
  width: 3px;
  height: 13px;
  border-radius: 999px;
  background: #94a3b8;
  opacity: .8;
  animation: steam 1.6s ease-in-out infinite;
}

.coffee-cup span {
  left: 7px;
}

.coffee-cup span::before {
  left: 8px;
  top: 2px;
  animation-delay: .35s;
}

@keyframes stressBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(3px) rotate(-2deg); }
}

@keyframes stressPop {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.08); }
}

@keyframes sweatDrop {
  0%, 100% { transform: translateY(0) rotate(16deg); opacity: .45; }
  50% { transform: translateY(8px) rotate(16deg); opacity: 1; }
}

@keyframes typingLeft {
  0%, 100% { transform: translateY(0) rotate(18deg); }
  50% { transform: translateY(5px) rotate(30deg); }
}

@keyframes typingRight {
  0%, 100% { transform: translateY(5px) rotate(-22deg); }
  50% { transform: translateY(0) rotate(-10deg); }
}

@keyframes screenBlink {
  0%, 100% { opacity: .55; transform: scaleX(.75); transform-origin: left; }
  50% { opacity: 1; transform: scaleX(1); }
}

@keyframes paperWobble {
  0%, 100% { transform: rotate(6deg) translateY(0); }
  50% { transform: rotate(-2deg) translateY(-4px); }
}

@keyframes steam {
  0%, 100% { transform: translateY(0); opacity: .25; }
  50% { transform: translateY(-8px); opacity: .9; }
}

.download-row .primary-download {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.download-row .secondary-download {
  color: var(--muted);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.compact-result-grid > section {
  min-width: 0;
}

.basket-panel {
  margin-top: 0;
}

.basket-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.basket-actions .primary-download {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.result-grid h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

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

.section-title-row h3 {
  margin: 0;
}

.review-open-btn {
  flex: 0 0 auto;
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-weight: 900;
}

.review-open-btn:disabled {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--muted);
  cursor: not-allowed;
}

.cut-summary-toolbar {
  display: grid;
  grid-template-columns: auto minmax(145px, .8fr) minmax(145px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
}

.cut-summary-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid #cfe0f3;
  border-radius: 9px;
  background: #eef6ff;
}

.cut-summary-tabs button {
  min-height: 32px;
  padding: 5px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #52647b;
}

.cut-summary-tabs button.active {
  background: #fff;
  color: #174f91;
  box-shadow: 0 2px 7px rgba(21, 35, 61, .12);
}

.cut-summary-toolbar label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.cut-summary-toolbar select {
  min-height: 34px;
}

.cut-summary-count {
  align-self: center;
  color: #174f91;
  font-size: 12px;
  white-space: nowrap;
}

.cut-cards {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.cut-card, .empty-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(21, 35, 61, .05);
}

.cut-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cut-card .production-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 8px;
}

.production-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.production-pill.serial {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.production-pill.odd {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.cut-card p {
  margin: 8px 0;
  color: #2d3c52;
  line-height: 1.45;
}

.cut-card small {
  color: var(--muted);
}

.cut-recipe-card {
  padding: 0;
  overflow: hidden;
}

.cut-recipe-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 11px 12px;
  cursor: pointer;
  background: #fbfdff;
  list-style: none;
}

.cut-recipe-head::-webkit-details-marker {
  display: none;
}

.cut-recipe-head > span:first-child {
  min-width: 0;
}

.cut-recipe-head b,
.cut-recipe-head small {
  display: block;
}

.cut-recipe-head small {
  margin-top: 2px;
}

.cut-recipe-card[open] .cut-recipe-head {
  border-bottom: 1px solid var(--line);
  background: #eef6ff;
}

.recipe-risk {
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.recipe-risk.safe { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.recipe-risk.review { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.recipe-risk.risk { border-color: #fdba74; background: #fff7ed; color: #9a3412; }
.recipe-risk.waste { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

.recipe-visual {
  padding: 0 12px;
}

.recipe-facts {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px !important;
  padding: 0 12px 10px;
}

.recipe-facts span {
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid #d9e4f0;
  border-radius: 7px;
  background: #fbfdff;
  color: var(--muted);
  font-size: 11px;
}

.recipe-facts b {
  color: var(--text);
  font-size: 13px;
}

.recipe-bar-list {
  display: block !important;
  padding: 8px 12px;
  border-top: 1px dashed var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.cut-card .cad-bar-wrap,
.cut-card .cad-measures,
.cut-card .cad-track {
  display: block;
}

.cad-bar-wrap {
  position: relative;
  margin-top: 10px;
  padding: 8px 8px 10px;
  border: 1px solid #c8d6e8;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdff, #f4f8fc);
}

.cad-measures {
  position: relative;
  height: 42px;
  margin: 0 4px;
}

.cad-measure {
  position: absolute;
  top: 0;
  height: 40px;
  min-width: 1px;
  overflow: visible;
  color: #172033;
  z-index: 4;
}

.cad-measure-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 19px;
  border-top: 1px solid #526175;
}

.cad-measure-line::before,
.cad-measure-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.cad-measure-line::before {
  left: 0;
  border-right: 7px solid #526175;
}

.cad-measure-line::after {
  right: 0;
  border-left: 7px solid #526175;
}

.cad-measure b {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  max-width: 120px;
  padding: 1px 5px;
  border: 1px solid #d7e1ef;
  border-radius: 4px;
  background: #fbfdff;
  color: #111827;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.cad-drop {
  position: absolute;
  top: 20px;
  height: 22px;
  border-left: 1px dashed #7f8da3;
}

.cad-drop.left {
  left: 0;
}

.cad-drop.right {
  right: 0;
}

.cad-track {
  position: relative;
  height: 24px;
  margin: 0 4px 2px;
  overflow: visible;
  border: 1px solid #46576f;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .9);
}

.cad-piece,
.cad-waste {
  position: absolute;
  top: 0;
  bottom: 0;
}

.cad-piece {
  border-right: 1px solid #c9d5e4;
  background: #eaf3ff;
}

.cad-piece.splice {
  background: #f4f1ff;
}

.cad-piece.shared {
  box-shadow: inset 0 -4px 0 #16a34a;
}

.cad-piece.angle-left::before,
.cad-piece.angle-right::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  background: repeating-linear-gradient(135deg, #f97316 0 4px, #fed7aa 4px 7px);
  opacity: .9;
}

.cad-piece.angle-left::before {
  left: 0;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.cad-piece.angle-right::after {
  right: 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.cad-waste {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-left: 1px dashed #d97706;
  background: repeating-linear-gradient(135deg, #fff7ed 0 8px, #fed7aa 8px 12px);
  color: #92400e;
}

.cad-waste b {
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.cad-kerf {
  position: absolute;
  top: -7px;
  bottom: -7px;
  width: 0;
  z-index: 8;
  border-left: 2px solid #dc2626;
  transform: translateX(-1px);
}

.cad-kerf::after {
  content: "X";
  position: absolute;
  left: -5px;
  top: -13px;
  color: #dc2626;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
}

.bar-visual {
  display: flex;
  justify-content: flex-start;
  gap: 0;
  width: 100%;
  height: 48px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid #98adc6;
  border-radius: 8px;
  background: repeating-linear-gradient(90deg, #e8eef6 0 18px, #dfe8f3 18px 19px);
}

.bar-seg {
  position: relative;
  isolation: isolate;
  min-width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255,255,255,.65);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-seg .seg-text {
  position: relative;
  z-index: 2;
  max-width: 100%;
  padding: 0 5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-seg.piece {
  background: linear-gradient(90deg, #1f6feb, #1754b8);
}

.bar-seg.piece.splice {
  background: linear-gradient(90deg, #7357d7, #5138b8);
}

.bar-seg.angle-left::before,
.bar-seg.angle-right::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22px;
  z-index: 1;
  background: repeating-linear-gradient(135deg, #f97316 0 5px, #fdba74 5px 9px);
}

.bar-seg.angle-left::before {
  left: 0;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.bar-seg.angle-right::after {
  right: 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.bar-seg.shared-right {
  box-shadow: inset -4px 0 0 #22c55e;
}

.bar-seg.shared-left {
  box-shadow: inset 4px 0 0 #22c55e;
}

.angle-mark {
  position: absolute;
  top: 2px;
  z-index: 3;
  max-width: 42px;
  padding: 1px 4px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 9px;
  line-height: 1.2;
  font-style: normal;
  font-weight: 900;
}

.angle-mark.left {
  left: 3px;
}

.angle-mark.right {
  right: 3px;
}

.bar-seg.waste {
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: #fffaf0;
}

.bar-badges {
  justify-content: flex-start !important;
  margin-top: 6px;
  gap: 6px !important;
  flex-wrap: wrap;
}

.bar-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
}

.bar-badge.angle {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.bar-badge.splice {
  background: #f4f1ff;
  color: #4c1d95;
  border: 1px solid #ddd6fe;
}

.bar-badge.miter {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.bar-badge.guide {
  background: #eef6ff;
  color: #1d4f91;
  border: 1px solid #bfdbfe;
}

.cut-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}

.cut-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid #cfe0f3;
  border-radius: 6px;
  background: #f8fbff;
  color: #24344d;
}

.cut-chip.splice {
  border-color: #ddd6fe;
  background: #f7f3ff;
}

.cut-chip.miter {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-weight: 800;
}

.mini-status {
  min-height: 44px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.mini-status.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--green);
}

.mini-status.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--red);
}

.hidden {
  display: none !important;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: var(--bg);
}

.login-shell {
  width: min(430px, calc(100vw - 32px));
}

.login-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.login-brand b {
  display: block;
  font-size: 22px;
}

.login-brand span {
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-error {
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: var(--red);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.step-head p,
.drop-zone small,
.paste-box label,
.field span,
.field-hint,
.splice-help,
.pdf-note,
.mini-status,
.status,
.decision-summary-main small,
.decision-note span,
.manual-splice-row span,
.manual-splice-preview small,
.cut-card p,
.cut-card small,
table,
input,
textarea,
select,
button {
  font-size: 14px;
}

.step-head h1,
.step-head h2 {
  font-size: 24px;
}

.step-head.compact h2,
.result-grid h3,
.manual-splice-head h3 {
  font-size: 21px;
}

.result-grid h3,
.manual-splice-head h3 {
  font-size: 18px;
}

.full {
  width: 100%;
}

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

  .work-stack {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .converter-grid, .pdf-upload-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    order: -1;
  }

  .result-panel {
    grid-column: auto;
  }

  .result-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .material-search-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 10px;
  }

  .topbar, .upload-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .summary-strip, .result-metrics, .two-col {
    grid-template-columns: 1fr;
  }

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

  .stock-actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .manual-splice-head,
  .manual-splice-row,
  .manual-splice-controls {
    grid-template-columns: 1fr;
  }

  .manual-splice-head {
    display: grid;
  }

  .decision-notes-group summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .decision-summary-main {
    flex: 1 1 calc(100% - 42px);
  }

  .decision-summary-badges {
    max-width: none;
    width: 100%;
    justify-content: flex-start;
    padding-left: 36px;
  }

  .brand b {
    font-size: 18px;
  }

  .step-head h1, .step-head h2 {
    font-size: 21px;
  }

  .calc-card {
    grid-template-columns: 1fr;
  }
}

.template-analysis-panel { margin: 12px 0; }
.safety-status-panel { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:12px 0; padding:12px 14px; border:1px solid; border-radius:12px; font-size:13px; }
.safety-status-panel b { font-size:14px; }
.safety-status-panel span { flex:1 1 320px; }
.safety-status-panel small { opacity:.78; }
.safety-status-panel.safe { background:#ecfdf5; border-color:#86efac; color:#166534; }
.safety-status-panel.warning { background:#fff7ed; border-color:#fdba74; color:#9a3412; }
.safety-status-panel.failed { background:#fef2f2; border-color:#fca5a5; color:#991b1b; }
.system-audit-panel { margin:12px 0; border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#f8fafc; color:#334155; }
.system-audit-panel.hidden { display:none; }
.system-audit-panel.warning { border-color:#fdba74; background:#fff7ed; color:#9a3412; }
.system-audit-panel.critical { border-color:#fca5a5; background:#fef2f2; color:#991b1b; }
.system-audit-panel.ok { border-color:#86efac; background:#ecfdf5; color:#166534; }
.system-audit-panel summary { display:flex; align-items:center; justify-content:space-between; gap:12px; cursor:pointer; padding:12px 14px; list-style:none; }
.system-audit-panel summary::-webkit-details-marker { display:none; }
.system-audit-panel summary span:first-child { display:grid; gap:3px; }
.system-audit-panel summary small { font-weight:400; opacity:.82; }
.system-audit-badges { display:flex; gap:6px; flex-wrap:wrap; }
.system-audit-badges em { border:1px solid currentColor; border-radius:999px; padding:4px 7px; font-size:11px; font-style:normal; font-weight:700; }
.system-audit-body { padding:0 14px 12px; border-top:1px dashed currentColor; }
.system-audit-body p { margin:10px 0; font-size:12px; overflow-wrap:anywhere; }
.system-audit-body ul { margin:0; padding:0; list-style:none; display:grid; gap:7px; }
.system-audit-body li { display:flex; gap:9px; padding:8px; border-radius:8px; background:rgba(255,255,255,.68); }
.system-audit-body li b { flex:0 0 190px; font-size:11px; overflow-wrap:anywhere; }
.system-audit-body li span { display:grid; gap:2px; font-size:12px; }
.system-audit-body li small { opacity:.78; }
.template-analysis-card { border: 1px solid var(--line); background: #fbfdff; border-radius: 14px; padding: 14px; box-shadow: var(--shadow-soft); }
.template-analysis-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.template-analysis-head b { display: block; font-size: 15px; color: var(--text); }
.template-analysis-head small { display: block; margin-top: 3px; color: var(--muted); }
.template-analysis-badge { border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.template-analysis-badge.ok { background: #e7f7ee; color: #166534; border: 1px solid #bbf7d0; }
.template-analysis-badge.warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.template-analysis-section { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.template-analysis-section b { color: var(--text); }
.template-analysis-section ul { margin: 8px 0 0 18px; padding: 0; color: var(--muted); }
.template-analysis-section li { margin: 5px 0; line-height: 1.35; }

/* V3.16 Profesyonel Kesim Özeti: çok parçalı reçetelerde kompakt görünüm */
.compact-bar-wrap {
  margin: 10px 0 8px;
  border: 1px solid #bfd0e5;
  background: linear-gradient(180deg, #f8fbff, #eef5fb);
  border-radius: 12px;
  padding: 10px;
}
.compact-track {
  min-height: 54px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  border-radius: 9px;
  overflow: hidden;
  background: #e9eff7;
  border: 1px solid #d6e2ef;
}
.compact-seg {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  background: #9cc7ed;
  color: #15324f;
  border-right: 1px solid rgba(255,255,255,.72);
  font-size: 12px;
  white-space: nowrap;
}
.compact-seg.micro {
  background: #c8eadc;
  color: #18503a;
}
.compact-seg b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compact-waste {
  margin-left: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff1bd;
  color: #7c4a03;
  font-size: 12px;
  font-weight: 800;
  padding: 0 8px;
  border-left: 1px solid #fde68a;
}
.compact-waste b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .cut-summary-toolbar,
  .cut-recipe-head,
  .recipe-facts {
    grid-template-columns: 1fr;
  }

  .cut-summary-count {
    white-space: normal;
  }
}
.compact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.compact-meta b {
  color: var(--text);
}
.compact-risk {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 700;
}
.cut-chip.micro {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
  font-weight: 700;
}
.compact-line {
  line-height: 1.7;
}

/* V3.49 Sonuc ekrani: karar odakli rapor akisi */
.result-report-flow {
  display: grid;
  gap: 18px;
}

.result-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid #d8e5f1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(21, 35, 61, .05);
}

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

.purchase-transfer-btn {
  flex: 0 0 auto;
  border-color: #93c5fd;
  background: #eff6ff;
  color: #174f91;
  font-weight: 900;
}

.purchase-transfer-btn:disabled {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #64748b;
}

.result-section-heading h3 {
  margin: 0;
  font-size: 19px;
}

.result-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.result-metrics {
  grid-template-columns: repeat(5, minmax(135px, 1fr));
  margin: 14px 0;
}

.result-metrics div:first-child {
  border-color: #93c5fd;
  background: linear-gradient(145deg, #eff6ff, #fff);
}

.result-metrics small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.download-row {
  margin: 0 0 18px;
  padding: 10px;
  background: #fff;
}

.purchase-summary-line {
  margin: 10px 0 0;
  color: #174f91;
  font-size: 13px;
  font-weight: 800;
}

.cut-summary-toolbar {
  grid-template-columns: auto minmax(150px, .8fr) minmax(170px, 1fr) minmax(210px, auto);
  padding: 11px;
  margin-bottom: 12px;
}

.cut-summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.cut-cards {
  gap: 12px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.cut-recipe-card {
  border-radius: 11px;
}

.cut-recipe-head {
  grid-template-columns: minmax(0, 1fr);
  padding: 14px 16px;
}

.recipe-sequence {
  display: grid;
  gap: 4px;
  margin: 0 !important;
  padding: 13px 16px 4px;
  color: var(--muted);
}

.recipe-sequence b {
  color: var(--text);
  font-size: 12px;
}

.recipe-sequence span {
  color: #174f91;
  font-size: 15px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.recipe-facts {
  padding: 10px 16px 12px;
}

.recipe-visual {
  padding: 2px 16px 10px;
}

.recipe-visual .cad-bar-wrap,
.recipe-visual .compact-bar-wrap {
  width: 100%;
}

.recipe-bar-list {
  padding: 10px 16px;
}

.show-all-cut-cards {
  width: 100%;
  min-height: 44px;
  border-color: #93c5fd;
  background: #eff6ff;
  color: #174f91;
  font-weight: 900;
}

.safety-status-panel {
  justify-content: space-between;
  padding: 14px 16px;
  margin: 12px 0 14px;
}

.safety-status-panel > div {
  display: grid;
  gap: 3px;
  flex: 1 1 420px;
}

.safety-status-panel > div b {
  font-size: 15px;
}

.safety-status-panel > div span {
  font-size: 13px;
  opacity: .86;
}

.safety-status-panel button {
  flex: 0 0 auto;
  border-color: currentColor;
  background: rgba(255, 255, 255, .72);
  color: inherit;
  font-weight: 900;
}

.safety-status-panel.advisory {
  border-color: #86efac;
  background: linear-gradient(90deg, #ecfdf5, #fffbeb);
  color: #166534;
}

.advanced-technical-panel {
  grid-column: 1 / -1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.advanced-technical-panel > details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.advanced-technical-panel > details > summary::-webkit-details-marker {
  display: none;
}

.advanced-technical-panel > details > summary span {
  display: grid;
  gap: 3px;
}

.advanced-technical-panel > details > summary small {
  color: var(--muted);
  font-weight: 500;
}

.advanced-technical-panel > details > summary em {
  padding: 5px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.advanced-technical-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
  border-top: 1px solid #dbe4ee;
}

.technical-detail-group {
  min-width: 0;
  padding-top: 14px;
}

.technical-detail-group + .technical-detail-group {
  border-top: 1px dashed #cbd5e1;
}

.technical-detail-group h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.technical-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.technical-metrics div {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid #dbe4ee;
  border-radius: 7px;
  background: #fff;
}

.technical-metrics span,
.technical-metrics b {
  font-size: 11px;
}

.technical-metrics span {
  color: var(--muted);
}

.safety-technical-details {
  display: grid;
  gap: 3px;
  margin-bottom: 9px;
  padding: 9px 10px;
  border: 1px solid #dbe4ee;
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
}

.safety-technical-details small {
  color: var(--muted);
}

.advanced-technical-panel .learning-panel,
.advanced-technical-panel .decision-notes,
.advanced-technical-panel .template-analysis-panel,
.advanced-technical-panel .system-audit-panel {
  margin: 0;
}

@media (max-width: 1180px) {
  .result-metrics {
    grid-template-columns: repeat(3, minmax(135px, 1fr));
  }

  .technical-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .cut-summary-toolbar,
  .cut-recipe-head,
  .recipe-facts {
    grid-template-columns: 1fr;
  }

  .cut-summary-actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .review-open-btn {
    width: 100%;
  }

  .technical-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .result-metrics,
  .technical-metrics {
    grid-template-columns: 1fr;
  }

  .download-row button {
    flex: 1 1 145px;
  }

  .result-section {
    padding: 13px;
  }

  .result-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-transfer-btn {
    width: 100%;
  }

  .advanced-technical-panel > details > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .advanced-technical-body {
    padding: 0 13px 13px;
  }

  .compact-track,
  .cad-track {
    min-width: 0;
  }
}

.admin-technical-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 24px auto;
  display: grid;
  gap: 16px;
}

.admin-technical-head,
.admin-technical-card {
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-technical-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-technical-head h1,
.admin-technical-card h2 {
  margin: 0;
}

.admin-technical-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.admin-technical-head a {
  padding: 9px 12px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
  color: #174f91;
  font-weight: 900;
  text-decoration: none;
}

.admin-audit-summary {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  padding: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.admin-audit-summary.critical {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.admin-audit-summary.warning {
  border-color: #fdba74;
  background: #fff7ed;
  color: #9a3412;
}

.admin-audit-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.admin-audit-facts div,
.admin-event-list div,
.admin-findings article {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid #dbe4ee;
  border-radius: 7px;
  background: #fbfdff;
}

.admin-audit-facts dt,
.admin-event-list span,
.admin-findings span {
  color: var(--muted);
  font-size: 12px;
}

.admin-audit-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.admin-findings,
.admin-event-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.admin-card-note,
.admin-signature-state {
  color: var(--muted);
}

.admin-save-message,
.admin-setting-error {
  padding: 12px 14px;
  border: 1px solid #86efac;
  border-radius: 10px;
  background: #f0fdf4;
  color: #166534;
  font-weight: 800;
}

.admin-setting-error {
  margin: 12px 0;
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.admin-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.admin-settings-form label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.admin-settings-form input[type="number"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.admin-settings-form .admin-setting-check {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.admin-setting-check span {
  display: grid;
  gap: 3px;
}

.admin-setting-check small {
  color: var(--muted);
  font-weight: 500;
}

.admin-settings-form button {
  justify-self: start;
  padding: 10px 14px;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.admin-protected-locks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 9px;
}

.admin-protected-locks span {
  padding: 9px;
  border: 1px solid #86efac;
  border-radius: 7px;
  background: #f0fdf4;
  color: #166534;
  font-size: 12px;
  font-weight: 900;
}

.admin-result-list,
.admin-technical-sections {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.admin-result-list a {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #fbfdff;
  color: #17324d;
  text-decoration: none;
}

.admin-result-list a.active {
  border-color: #60a5fa;
  background: #eff6ff;
  box-shadow: inset 3px 0 #2563eb;
}

.admin-result-list span,
.admin-result-list small {
  color: var(--muted);
}

.admin-technical-sections details {
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #fbfdff;
}

.admin-technical-sections summary {
  padding: 11px;
  color: #17324d;
  font-weight: 900;
  cursor: pointer;
}

.admin-technical-sections pre {
  max-height: 520px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-top: 1px solid #dbe4ee;
  background: #0f172a;
  color: #dbeafe;
  font: 12px/1.5 Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .admin-technical-head {
    flex-direction: column;
  }

  .admin-audit-facts,
  .admin-settings-form,
  .admin-protected-locks {
    grid-template-columns: 1fr;
  }
}

.stock-alternative-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.stock-alternative-panel.hidden {
  display: none;
}

.stock-alternative-panel.warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.stock-alternative-panel.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.stock-alternative-panel.info {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.stock-alternative-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.stock-alternative-head div {
  display: grid;
  gap: 3px;
}

.stock-alternative-head b {
  font-size: 14px;
}

.stock-alternative-head small,
.stock-alternative-panel p,
.stock-alternative-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stock-alternative-head span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 900;
}

.stock-alternative-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stock-alternative-grid article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.stock-alternative-grid span {
  font-size: 13px;
  font-weight: 900;
}

@media (max-width: 760px) {
  .stock-alternative-head {
    display: grid;
  }

  .stock-alternative-head span {
    justify-self: start;
  }

  .stock-alternative-grid {
    grid-template-columns: 1fr;
  }
}

.stock-alternative-panel.selected {
  border-color: #93c5fd;
  background: #eff6ff;
}

.stock-scenario-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


.stock-alternative-panel.high-waste {
  border-color: rgba(217, 119, 6, 0.55);
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 237, 0.94));
}

.stock-alternative-warning {
  border: 1px solid rgba(217, 119, 6, 0.36);
  border-radius: 10px;
  background: rgba(255, 251, 235, 0.96);
  color: #92400e;
  font-size: 12px;
  line-height: 1.45;
  padding: 9px 10px;
}

.stock-alternative-warning b {
  color: #78350f;
}

.stock-scenario-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 10px;
}

.stock-scenario-actions button.active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}

.stock-scenario-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.stock-alternative-grid article.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.stock-alternative-grid article.balanced-preview {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(238, 242, 255, 0.72);
}

.stock-alternative-grid article.balanced-preview em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.plan-decision-box {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.plan-decision-box b {
  font-size: 13px;
}

.plan-decision-box span,
.plan-decision-box small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.plan-decision-box {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.plan-decision-box b {
  font-size: 13px;
}

.plan-decision-box span,
.plan-decision-box small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

/* V3.92: dengeli plan ekranda secilebilir, export hala kapali. */
.stock-scenario-actions button[data-plan-scenario="balanced_stock_controlled_splice"].active {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #5b21b6;
}

.stock-alternative-grid article.balanced-preview.selected {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.14);
}


.strategy-comparison-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.strategy-comparison-panel.hidden {
  display: none;
}

.strategy-comparison-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.strategy-comparison-head div {
  display: grid;
  gap: 3px;
}

.strategy-comparison-head b {
  font-size: 14px;
}

.strategy-comparison-head small,
.strategy-comparison-panel p,
.strategy-comparison-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.strategy-comparison-head span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
}

.strategy-comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.strategy-comparison-grid article {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.strategy-comparison-grid article.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.strategy-comparison-grid span {
  font-size: 13px;
  font-weight: 900;
}

.strategy-card-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.strategy-card-title em {
  color: #1d4ed8;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

@media (max-width: 900px) {
  .strategy-comparison-grid {
    grid-template-columns: 1fr;
  }
  .strategy-comparison-head {
    display: grid;
  }
  .strategy-comparison-head span {
    justify-self: start;
  }
}

/* V4.13: strateji kartindan secim */
.strategy-comparison-grid article button {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}
.strategy-comparison-grid article.selected button,
.strategy-comparison-grid article button:disabled {
  cursor: default;
  opacity: 0.65;
}

/* V4.17K: hata/denetim kutuları sağ paneli taşırıp ekranı yarım okunur hale getirmesin. */
.system-audit-panel { max-width: 100%; }
.system-audit-panel details { max-height: 260px; overflow: auto; }
.system-audit-body li { min-width: 0; }
.system-audit-body li b { flex:0 0 128px; }
.system-audit-body li span,
.system-audit-body li small { min-width:0; overflow-wrap:anywhere; word-break:break-word; }
@media (max-width: 1200px) {
  .system-audit-body li { display:grid; gap:4px; }
  .system-audit-body li b { flex:auto; }
}

/* V4.17ZJ: Auto-QA gercek saha veri yukleme alanı */
.admin-settings-form textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
.admin-settings-form input[type="file"] {
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}

/* V4.17ZO Auto-QA test karnesi */
.autoqa-scorecard-summary{display:flex;gap:12px;align-items:center;padding:12px 14px;border-radius:12px;margin:10px 0;background:#f8fafc;border:1px solid #e2e8f0}
.autoqa-scorecard-summary.pass{background:#ecfdf5;border-color:#bbf7d0;color:#065f46}
.autoqa-scorecard-summary.fail{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.autoqa-scorecard-summary.timeout,.autoqa-scorecard-summary.warn{background:#fffbeb;border-color:#fde68a;color:#92400e}
.autoqa-scorecard-summary.running{background:#eff6ff;border-color:#bfdbfe;color:#1e40af}
.autoqa-scorecard-metrics{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:12px 0}
.autoqa-scorecard-metrics div{padding:10px;border:1px solid #e2e8f0;border-radius:12px;background:#fff;display:flex;flex-direction:column;gap:2px}
.autoqa-scorecard-metrics b{font-size:20px}.autoqa-scorecard-metrics span{font-size:12px;color:#64748b}
.autoqa-scorecard-table-wrap{overflow:auto;border:1px solid #e2e8f0;border-radius:12px;background:#fff}
.autoqa-scorecard-table{width:100%;border-collapse:collapse;font-size:13px}.autoqa-scorecard-table th,.autoqa-scorecard-table td{padding:9px 10px;border-bottom:1px solid #e2e8f0;text-align:left;vertical-align:middle}.autoqa-scorecard-table th{background:#f8fafc;color:#475569;font-weight:700}.autoqa-scorecard-table tr.pass td:first-child{border-left:4px solid #16a34a}.autoqa-scorecard-table tr.fail td:first-child{border-left:4px solid #dc2626}.autoqa-scorecard-table tr.timeout td:first-child{border-left:4px solid #d97706}.autoqa-scorecard-table tr.running td:first-child{border-left:4px solid #2563eb}.autoqa-scorecard-table tr.warn td:first-child,.autoqa-scorecard-table tr.unknown td:first-child{border-left:4px solid #ca8a04}.autoqa-scorecard-table tr.nodata td:first-child{border-left:4px solid #94a3b8}
@media (max-width: 800px){.autoqa-scorecard-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* V4.17ZT Auto-QA tani paketi akisi */
.autoqa-diagnostic-flow-note{padding:10px 12px;border:1px dashed #94a3b8;border-radius:12px;background:#f8fafc;color:#334155;margin:10px 0;font-size:13px}
.autoqa-diagnostic-action{min-width:180px;display:flex;flex-direction:column;gap:5px;align-items:flex-start}
.autoqa-diagnostic-action small{display:block;color:#64748b;line-height:1.25;max-width:260px}
.autoqa-diagnostic-action.READY_DOWNLOAD{background:#ecfdf5}
.autoqa-diagnostic-action.NEEDS_CREATE{background:#fff7ed}
.autoqa-diagnostic-action.WAIT_RUNNING{background:#eff6ff}
.autoqa-diagnostic-download{font-weight:700;color:#047857;text-decoration:underline}
.autoqa-diagnostic-action button{border:0;border-radius:10px;background:#0f172a;color:#fff;padding:7px 10px;font-weight:700;cursor:pointer}
.autoqa-diagnostic-action.NEEDS_CREATE button{background:#b45309}
.autoqa-diagnostic-action.OPTIONAL_CREATE button{background:#475569}

.autoqa-diagnostic-action.READY_FOR_CHATGPT{background:#ecfdf5}
.autoqa-chatgpt-ready{margin-top:4px;padding:6px 7px;border:1px solid #bbf7d0;border-radius:9px;background:#f0fdf4;color:#065f46;font-size:12px;line-height:1.3}
.autoqa-chatgpt-ready span{color:#047857}
