@font-face {
  font-family: Sarabun;
  src: url("./vendor/Sarabun-Regular.ttf");
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    16px/1.5 Sarabun,
    system-ui,
    sans-serif;
  color: #202939;
  background: #f2f4f7;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  transition:
    background 0.16s,
    box-shadow 0.16s;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #6093f9;
  outline-offset: 2px;
}
button {
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: white;
  color: inherit;
  min-height: 38px;
  padding: 8px 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  white-space: nowrap;
}
button:hover {
  background: #f0f3f7;
}
button.primary {
  background: #d1f36b;
  border-color: #d1f36b;
  color: #19221a;
  font-weight: bold;
}
button.primary:hover {
  background: #bde24f;
}
button.dark {
  background: #273449;
  color: white;
  border-color: #273449;
}
button.ghost {
  background: transparent;
  border-color: transparent;
}
button.small {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 13px;
}
button.icon {
  padding: 8px;
  width: 38px;
  flex-shrink: 0;
}
button.active {
  background: #eaf0ff;
  border-color: #adc5ff;
  color: #245cd6;
}
.ico {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}
.appbar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  background: #171e2b;
  color: #eaf0f8;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 240px;
}
.brand-mark {
  width: 33px;
  height: 33px;
}
.brand strong {
  font: 750 21px/1.1 system-ui;
  letter-spacing: -0.7px;
}
.brand small {
  display: block;
  font: 10px/1.6 system-ui;
  letter-spacing: 3.1px;
  color: #93a0b5;
}
.project-name {
  border: 0 !important;
  outline: none;
  background: transparent !important;
  color: #f1f4f8;
  width: 210px !important;
  font-size: 16px !important;
  padding: 4px !important;
}
.save-state {
  color: #a6b3c6;
  font-size: 12px;
}
.top-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.appbar button:not(.primary) {
  background: #263041;
  border-color: #364154;
  color: #e8edf5;
}
.appbar button:hover {
  background: #354256;
}
.shell {
  display: grid;
  grid-template-columns: 68px 302px minmax(0, 1fr);
  height: calc(100dvh - 72px);
}
.rail {
  background: #202938;
  color: #aab6c9;
  padding: 22px 8px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-direction: column;
}
.rail button {
  background: transparent;
  border: 0;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  width: 52px;
  padding: 10px 2px;
}
.rail button .ico {
  width: 22px;
  height: 22px;
}
.rail button.active {
  background: #354235;
  color: #d1f36b;
}
.rail-bottom {
  margin-top: auto;
}
.settings {
  background: white;
  border-right: 1px solid #dfe4ea;
  overflow: auto;
}
.panel-heading {
  padding: 22px 22px 12px;
}
.eyebrow {
  font: 11px/1.3 system-ui;
  letter-spacing: 1.8px;
  color: #8b95a4;
  font-weight: 600;
}
.panel-heading h1 {
  font-size: 21px;
  margin: 6px 0 0;
}
.mode-switch {
  display: flex;
  background: #eef1f5;
  padding: 4px;
  border-radius: 9px;
  margin: 0 20px 20px;
  gap: 3px;
}
.mode-switch button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 7px 4px;
}
.mode-switch button.active {
  background: white;
  color: #172c4f;
  box-shadow: 0 1px 4px #132b4420;
}
.section {
  padding: 18px 22px;
  border-top: 1px solid #edf0f4;
}
.section h2 {
  font-size: 15px;
  margin: 0 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.muted {
  color: #8190a3;
  font-size: 12px;
}
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.template {
  flex-direction: column;
  gap: 8px;
  min-height: 78px;
  background: #fbfcfe;
  border-color: #e6eaf0;
}
.template .ico {
  width: 27px;
  height: 27px;
  stroke-width: 1.3;
}
.template.active {
  box-shadow: 0 0 0 1px #597fb5;
  background: #f0f5fc;
}
.field {
  margin: 10px 0;
}
.field > label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #647084;
  font-size: 14px;
  margin-bottom: 5px;
}
.field input,
.field select,
input.text,
select {
  border: 1px solid #dce2ea;
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
  color: #283449;
  min-height: 39px;
  width: 100%;
  min-width: 0;
}
.field input[type="number"] {
  font-family: system-ui;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.field input[type="range"] {
  padding: 0;
}
.field .unit {
  color: #99a2b0;
  font-size: 12px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.fields .field {
  min-width: 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 12px 0;
  color: #566175;
}
.check input {
  accent-color: #2f67c8;
  width: 16px;
  height: 16px;
}
.hint {
  font-size: 12px;
  line-height: 1.6;
  color: #7f8c9f;
}
.tip {
  background: #f3f6f9;
  padding: 12px;
  border-radius: 7px;
  font-size: 12px;
  color: #63748b;
  line-height: 1.65;
}
.workarea {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.toolbar {
  background: #fff;
  border-bottom: 1px solid #dfe4ea;
  min-height: 62px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tabs {
  display: flex;
  gap: 4px;
}
.tabs button {
  border: 0;
  background: transparent;
  color: #7e8b9b;
  padding: 8px 13px;
}
.tabs button.active {
  background: #eaf0fb;
  color: #2e5eac;
}
.toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.badge {
  font: 11px/1.4 system-ui;
  letter-spacing: 0.5px;
  background: #edf0f5;
  border: 1px solid #dce2eb;
  color: #79889c;
  padding: 6px 9px;
  border-radius: 5px;
}
.canvas {
  position: relative;
  flex: 1;
  min-height: 270px;
  background: #f0f3f7;
  overflow: hidden;
}
.canvas-label {
  position: absolute;
  top: 22px;
  left: 25px;
  z-index: 2;
  pointer-events: none;
}
.canvas-label h2 {
  font-size: 16px;
  margin: 0 0 5px;
  font-weight: 400;
  color: #516277;
}
.canvas-label p {
  font-size: 12px;
  margin: 0;
  color: #98a4b3;
}
.canvas-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  padding: 5px;
  background: #ffffffed;
  box-shadow: 0 4px 18px #16284012;
  border: 1px solid #dbe2ec;
  border-radius: 10px;
  z-index: 3;
  align-items: center;
}
.canvas-controls button {
  background: transparent;
  border: 0;
}
.canvas-controls .separator {
  height: 22px;
  width: 1px;
  background: #e0e5eb;
  margin: 0 4px;
}
.canvas-controls label {
  font-size: 12px;
  margin-right: 5px;
}
.canvas-controls input {
  width: 76px;
  accent-color: #466aac;
}
.canvas-view {
  position: absolute;
  inset: 0;
}
.canvas-view canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.sheet-view {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 76px 36px 90px;
  display: flex;
  justify-content: center;
  gap: 28px;
  align-items: flex-start;
}
.sheet-card {
  background: white;
  border: 1px solid #d8e0ec;
  box-shadow: 0 10px 28px #283c5012;
  flex-shrink: 0;
  position: relative;
  width: min(100%, 550px);
}
.sheet-card svg {
  width: 100%;
  max-height: 60vh;
  display: block;
}
.sheet-title {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #7c8c9f;
  border-bottom: 1px solid #e9edf2;
}
.empty {
  margin: auto;
  text-align: center;
  color: #8794a6;
  padding: 40px;
  max-width: 430px;
}
.empty strong {
  display: block;
  font-size: 20px;
  color: #3e4c60;
  margin-bottom: 12px;
}
.metric-strip {
  background: #fff;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid #dfe4ea;
  padding: 18px 26px;
  gap: 20px;
}
.metric {
  border-right: 1px solid #e8ecf2;
}
.metric:last-child {
  border: 0;
}
.metric-label {
  font-size: 12px;
  color: #8b97a7;
  margin-bottom: 4px;
}
.metric strong {
  font: 600 23px/1.2 system-ui;
  letter-spacing: -0.6px;
}
.metric span {
  font-size: 12px;
  color: #8a96a5;
  margin-left: 6px;
}
.statusbar {
  background: #f8fafc;
  border-top: 1px solid #e7ebf1;
  padding: 7px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #8290a2;
  gap: 10px;
}
.statusbar .warn {
  color: #af7522;
}
.statusbar .ok {
  color: #59726a;
}
.parts-wrap {
  position: absolute;
  inset: 0;
  padding: 25px;
  overflow: auto;
  background: #f5f7fa;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: white;
  border: 1px solid #e0e5ed;
}
th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e7ecf3;
}
th {
  background: #eff3f8;
  font-weight: 400;
  color: #738197;
  font-size: 12px;
}
.code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: #eef3f8;
  border-radius: 4px;
  padding: 3px 6px;
  color: #4a688c;
}
.object-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.object-row {
  display: flex;
  align-items: center;
  border: 1px solid #e0e5ed;
  border-radius: 7px;
  padding: 7px;
  gap: 6px;
}
.object-row.selected {
  border-color: #6690d0;
  background: #f0f5ff;
}
.object-row > button:first-child {
  flex: 1;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
}
.danger {
  color: #c35757;
}
.grid-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.grid-buttons button {
  flex-direction: column;
  font-size: 12px;
  gap: 6px;
  min-height: 66px;
  padding: 8px 3px;
}
.wide {
  width: 100%;
  margin-top: 8px;
}
.error-banner {
  position: absolute;
  bottom: 78px;
  left: 24px;
  right: 24px;
  background: #fff3e4;
  color: #975b1a;
  font-size: 13px;
  border: 1px solid #efd4ac;
  border-radius: 8px;
  padding: 12px 15px;
  z-index: 5;
}
.dimensions {
  position: absolute;
  right: 24px;
  top: 22px;
  display: flex;
  gap: 12px;
  z-index: 2;
  font: 12px system-ui;
  color: #8594a8;
}
.dimensions span {
  background: #ffffffa6;
  padding: 5px 8px;
  border-radius: 5px;
}
.sheet-select {
  width: auto;
  min-width: 130px;
  font-size: 13px;
  padding: 6px 8px;
  min-height: 36px;
}
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e2c41;
  color: white;
  padding: 12px 22px;
  border-radius: 9px;
  z-index: 100;
  font-size: 14px;
  box-shadow: 0 8px 24px #14203135;
  opacity: 0;
  transition:
    transform 0.2s,
    opacity 0.2s;
  max-width: 90vw;
}
#toast.show {
  transform: translateX(-50%);
  opacity: 1;
}
dialog {
  border: 1px solid #d4dde8;
  border-radius: 15px;
  padding: 0;
  width: 640px;
  max-width: 94vw;
  max-height: 90dvh;
  color: #243247;
  box-shadow: 0 30px 90px #13213855;
}
dialog::backdrop {
  background: #0c152265;
  backdrop-filter: blur(4px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e8edf3;
}
.modal-head h2 {
  margin: 0;
  font-size: 21px;
}
.modal-body {
  padding: 22px 25px;
  overflow: auto;
  max-height: 69dvh;
}
.modal-footer {
  border-top: 1px solid #e7ecf3;
  padding: 16px 25px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.export-choice {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid #dfe5ee;
  padding: 14px;
  border-radius: 9px;
  margin: 9px 0;
}
.export-choice strong {
  display: block;
  font-size: 15px;
}
.export-choice p {
  font-size: 12px;
  color: #8895a6;
  margin: 4px 0 0;
}
.export-choice button {
  margin-left: auto;
}
.file-icon {
  background: #edf2f9;
  color: #4f6f9d;
  border-radius: 8px;
  min-width: 50px;
  text-align: center;
  font: 700 12px system-ui;
  padding: 17px 4px;
}
.warning {
  background: #fff6e7;
  border: 1px solid #eedbbd;
  color: #8e6b35;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
}
.error-text {
  color: #b84444;
  font-size: 13px;
  min-height: 20px;
}
.job {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid #e1e6ed;
  border-radius: 8px;
  padding: 13px;
  margin-bottom: 9px;
}
.job strong {
  display: block;
  font-size: 15px;
}
.job small {
  color: #91a0b3;
  font-size: 12px;
}
.job button {
  margin-left: auto;
}
.help p,
.help li {
  color: #65758c;
  font-size: 14px;
  line-height: 1.8;
}
.help h3 {
  font-size: 16px;
}
.print-only {
  display: none;
}
@media (min-width: 1550px) {
  .shell {
    grid-template-columns: 76px 328px minmax(0, 1fr);
  }
  .panel-heading,
  .section {
    padding-left: 26px;
    padding-right: 26px;
  }
  .appbar {
    padding-right: 32px;
  }
  .canvas-label {
    top: 28px;
    left: 32px;
  }
}
@media (max-width: 1000px) {
  .brand {
    min-width: 0;
  }
  .project-block {
    display: none;
  }
  .shell {
    grid-template-columns: 56px 270px minmax(0, 1fr);
  }
  .rail {
    padding: 16px 3px;
  }
  .section {
    padding: 16px;
  }
  .panel-heading {
    padding: 20px 16px 12px;
  }
  .mode-switch {
    margin: 0 16px 16px;
  }
  .toolbar {
    padding: 10px 12px;
  }
  .tabs button {
    padding: 8px;
  }
  .toolbar-right .badge {
    display: none;
  }
  .metric-strip {
    padding: 15px;
    gap: 10px;
  }
  .metric strong {
    font-size: 20px;
  }
  .metric span {
    display: block;
    margin: 3px 0 0;
  }
  .dimensions {
    display: none;
  }
}
@media (max-width: 720px) {
  .appbar {
    height: 64px;
    padding: 0 12px;
    gap: 10px;
  }
  .brand strong {
    font-size: 18px;
  }
  .brand small {
    font-size: 8px;
  }
  .brand-mark {
    width: 29px;
  }
  .appbar button {
    padding: 7px 9px;
  }
  .top-actions .hide-mobile {
    display: none;
  }
  .shell {
    height: auto;
    min-height: calc(100dvh - 64px);
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  .rail {
    flex-direction: row;
    gap: 12px;
    padding: 5px 12px;
    justify-content: space-between;
  }
  .rail button {
    flex-direction: row;
    width: auto;
    padding: 7px 10px;
    font-size: 12px;
    min-height: 34px;
  }
  .rail-bottom {
    margin: 0;
  }
  .settings {
    max-height: unset;
    overflow: visible;
    order: 2;
    border-top: 1px solid #d7dfeb;
  }
  .settings .panel-heading {
    display: none;
  }
  .mode-switch {
    margin: 15px;
  }
  .section {
    padding: 16px 20px;
  }
  .workarea {
    height: 620px;
    min-height: 70dvh;
    order: 1;
  }
  .canvas {
    min-height: 330px;
  }
  .toolbar {
    gap: 3px;
    padding: 9px 8px;
  }
  .tabs button {
    font-size: 12px;
    gap: 5px;
    padding: 7px;
  }
  .tabs .ico {
    width: 15px;
  }
  .toolbar-right {
    gap: 4px;
  }
  .toolbar-right button {
    padding: 5px;
    width: 31px;
    min-height: 32px;
  }
  .canvas-label {
    left: 17px;
    top: 17px;
  }
  .canvas-label h2 {
    font-size: 14px;
  }
  .canvas-controls {
    bottom: 12px;
    max-width: 95%;
    font-size: 12px;
  }
  .canvas-controls button {
    font-size: 12px;
    padding: 5px 7px;
  }
  .metric-strip {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 13px 12px;
  }
  .metric strong {
    font-size: 18px;
  }
  .metric-label {
    font-size: 11px;
  }
  .statusbar {
    padding: 7px 12px;
    font-size: 11px;
  }
  .statusbar > span:last-child {
    display: none;
  }
  .sheet-view {
    padding: 60px 20px 80px;
  }
  .export-choice {
    padding: 10px;
    gap: 8px;
  }
  .export-choice button {
    font-size: 12px;
  }
  .modal-body {
    padding: 16px;
  }
  .template-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .template {
    font-size: 12px;
    padding: 7px 4px;
  }
  .panel-mobile-hide {
    display: none;
  }
}
@media print {
  body {
    background: white;
  }
  body > * {
    display: none !important;
  }
  body > .print-only {
    display: block !important;
  }
  h1 {
    font-size: 24px;
  }
  table {
    font-size: 12px;
  }
  svg {
    max-height: 70vh;
  }
  p {
    font-size: 12px;
  }
}

@media (max-width: 720px) {
  .rail {
    gap: 3px;
    padding: 5px 8px;
  }
  .rail button {
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    width: 66px;
    padding: 5px 2px;
    min-height: 48px;
  }
  .rail button .ico {
    width: 18px;
    height: 18px;
  }
  .rail-bottom {
    display: contents;
  }
  .appbar .brand {
    gap: 7px;
  }
}

/* 2D editor: objects can be dragged with mouse, pen or finger. */
.vector-object {
  cursor: grab;
  touch-action: none;
}
.vector-object:active {
  cursor: grabbing;
}
#vector-svg {
  user-select: none;
  -webkit-user-select: none;
}

/* Seven rail buttons must fit a phone: labels shrink rather than overflow. */
@media (max-width: 720px) {
  .rail button {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
  }
}

/* 2D editor: sub headings and operation tags in the object list. */
.sub-head {
  font-size: 12px;
  font-weight: 700;
  color: #5d6b80;
  margin: 16px 0 4px;
  padding-top: 10px;
  border-top: 1px dashed #e3e8ef;
}
.op-chip {
  margin-left: auto;
  font-size: 10.5px;
  border-radius: 8px;
  padding: 1px 7px;
  background: #eef2f7;
  color: #5d6b80;
}
.op-chip.op-cut { background: #fbe9e6; color: #b04a3e; }
.op-chip.op-engrave { background: #e8effb; color: #3c66b5; }
.op-chip.op-fill { background: #ece6df; color: #4b3a2b; }
.op-chip.op-image { background: #eef5dc; color: #4c6524; }
.object-row > button:first-child { gap: 6px; }

/* Free parts: three modes in the switch, the piece editor and the cards. */
.mode-switch.three button { flex-direction: column; gap: 3px; font-size: 12px; padding: 7px 2px; white-space: normal; line-height: 1.25; }
.mat-chip { background: #f3eee4; color: #6a5236; white-space: nowrap; }
.chip-buttons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.fields.three { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fields.three label { font-size: 12px; }
.hole-card { border: 1px solid #e3e8ef; border-radius: 8px; padding: 6px 7px 8px; margin-top: 6px; background: #fafbfd; }
.hole-top { display: flex; align-items: center; gap: 6px; }
.hole-no { font: 600 11px system-ui; color: #7c8c9f; min-width: 14px; text-align: center; }
.hole-top select { flex: 1; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.hole-top button { min-height: 30px; width: 30px; padding: 0; }
.hole-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 5px; }
.hole-nums label { display: flex; flex-direction: column; gap: 1px; font-size: 10.5px; color: #8b95a4; min-width: 0; }
.hole-nums input { width: 100%; min-width: 0; min-height: 32px; padding: 4px 5px; border: 1px solid #dce2ea; border-radius: 6px; background: #fff; font: 13px system-ui; color: #283449; font-variant-numeric: tabular-nums; }
.piece-grid { position: absolute; inset: 0; overflow: auto; padding: 84px 26px 100px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; align-content: start; }
.piece-card { flex-direction: column; align-items: stretch; gap: 3px; padding: 10px 12px 12px; background: #fff; border: 1px solid #dfe5ee; border-radius: 12px; text-align: left; white-space: normal; box-shadow: 0 6px 18px #283c500d; }
.piece-card:hover { background: #fbfcfe; border-color: #c9d5e6; }
.piece-card svg { width: 100%; height: 150px; display: block; }
.piece-card.selected { border-color: #5f8bd6; box-shadow: 0 0 0 3px #5f8bd626; }
.piece-name { font-weight: 600; color: #22324a; font-size: 14px; }
.piece-name b { color: #466aac; }
.piece-meta { font-size: 12px; color: #7c8c9f; }
.piece-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #7c8c9f; padding: 40px; }
.piece-empty strong { color: #38475d; font-size: 18px; }
.piece-empty .chip-buttons { justify-content: center; max-width: 460px; }
/* Starting a new job. */
.new-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.new-type { position: relative; display: flex; gap: 10px; align-items: flex-start; border: 1px solid #dfe5ee; border-radius: 10px; padding: 11px; cursor: pointer; }
.new-type input { position: absolute; opacity: 0; pointer-events: none; }
.new-type:has(input:checked) { border-color: #5f8bd6; background: #f0f5ff; box-shadow: 0 0 0 2px #5f8bd626; }
.new-type:has(input:focus-visible) { outline: 3px solid #6093f9; outline-offset: 2px; }
.new-type .ico { width: 22px; height: 22px; color: #466aac; margin-top: 2px; }
.new-type strong { display: block; font-size: 14px; color: #22324a; }
.new-type small { display: block; color: #7c8c9f; font-size: 12px; line-height: 1.5; }
.new-job:not([data-type="vector"]) .only-vector,
.new-job[data-type="template"] .not-template,
.new-job:not([data-type="template"]) .only-template { display: none; }
@media (max-width: 600px) {
  .new-types { grid-template-columns: 1fr; }
  .piece-grid { padding: 76px 12px 96px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .piece-card svg { height: 120px; }
}

/* Drawing a free part point by point. */
.sketch-wrap { position: absolute; inset: 0; background: #fbfcfe; }
.sketch-wrap svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: default; user-select: none; }
.sketch-wrap.drawing svg { cursor: crosshair; }
.sk-fill { stroke: #b0563f; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.sk-edge { fill: none; stroke: transparent; stroke-width: 14; vector-effect: non-scaling-stroke; cursor: pointer; pointer-events: stroke; }
.sk-edge:hover { stroke: #5f8bd633; }
.sk-edge.on { stroke: #2f6fe4aa; stroke-width: 5; }
.sk-pt { fill: #fff; stroke: #2f6fe4; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: move; }
.sk-pt.round { fill: #e2ecfd; }
.sk-pt.on { fill: #2f6fe4; }
.sk-mid { cursor: copy; opacity: 0.55; }
.sk-mid:hover { opacity: 1; }
.sk-mid circle { fill: #fff; stroke: #7f9cc7; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.sk-mid path { stroke: #2f6fe4; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.sk-hole path { fill: none; stroke: #b0563f; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.sk-hole circle { fill: #fff4f1; stroke: #b0563f; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: move; }
.sk-hole.on circle { fill: #b0563f; }
.sk-ghost { fill: #2f6fe410; stroke: #2f6fe4; stroke-width: 1.4; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.sk-guide { stroke: #e0563c; stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.sk-draw { fill: none; stroke: #2f6fe4; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.sk-cursor { fill: #2f6fe4; pointer-events: none; }
.sk-label { fill: #1d3b6e; paint-order: stroke; stroke: #fff; stroke-width: 3px; vector-effect: non-scaling-stroke; pointer-events: none; font-family: system-ui; }
.sk-dim path { stroke: #9aa8bb; stroke-width: 1; vector-effect: non-scaling-stroke; fill: none; }
.sk-dim text { fill: #6b7a8e; font-family: system-ui; }
.sketch-hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 72px; max-width: min(92%, 760px); background: #ffffffee; border: 1px solid #dfe5ee; border-radius: 10px; padding: 7px 12px; font-size: 12.5px; color: #4e5d72; text-align: center; box-shadow: 0 6px 18px #283c5014; pointer-events: none; }
.sketch-wrap.drawing .sketch-hint { border-color: #9dbbf0; background: #f0f5ffee; }
.sk-typed { color: #2f6fe4; font-size: 14px; }
.sketch-scale { position: absolute; right: 14px; top: 64px; font: 11px system-ui; color: #8b95a4; background: #fffc; padding: 2px 6px; border-radius: 6px; }
.mini-select { width: auto; min-height: 30px; padding: 3px 6px; font-size: 12.5px; border-radius: 7px; }
.mini-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: #4e5d72; white-space: nowrap; }
.canvas-controls .mini-check input { width: auto; margin: 0; }
.draw-btn { background: #273449; color: #fff; border-color: #273449; margin-top: 0; }
.draw-btn:hover { background: #34445e; }

.project-tabs { display: flex; overflow-x: auto; background: #e2e8f0; padding: 6px 6px 0; gap: 4px; } .project-tab { padding: 6px 12px; background: #cbd5e1; border-radius: 6px 6px 0 0; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13px; color: #475569; } .project-tab.active { background: #f8fafc; font-weight: 500; color: #0f172a; } .project-tab:hover:not(.active) { background: #e2e8f0; } .tab-close { font-size: 16px; width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 50%; opacity: 0.5; } .tab-close:hover { opacity: 1; background: #e2e8f0; color: #ef4444; }
