* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; background: #f2f2f0; color: #1d1d1f; }
.card { max-width: 640px; margin: 2rem auto; padding: 1.5rem; background: #fff; border-radius: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.sub { margin: 0 0 1.5rem; color: #6e6e73; font-size: .9rem; }
fieldset { border: 1px solid #e3e3e0; border-radius: 8px; margin: 0 0 1.25rem; padding: 1rem; }
legend { font-weight: 600; padding: 0 .4rem; }
[hidden] { display: none !important; }
label, .field { display: block; margin: 0 0 1.25rem; font-size: .92rem; font-weight: 500; }
#fw-detail { margin-top: .6rem; }
.label { display: block; margin-bottom: .35rem; }
input[type=text], input[type=date], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .6rem;
  border: 1px solid #c9c9c5; border-radius: 6px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #2d6cdf; border-color: #2d6cdf; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .3rem .8rem; }
.check-row { display: flex; align-items: center; gap: .45rem; font-weight: 400; margin: .2rem 0; }
.check-row input { width: auto; margin: 0; }
.hint { color: #6e6e73; font-size: .8rem; margin: .2rem 0 0; }
.file-field:last-child { margin-bottom: .25rem; }
.file-controls { display: flex; gap: .5rem; flex-wrap: wrap; }
.file-btn {
  display: inline-flex; align-items: center; gap: .45rem; margin: 0;
  padding: .55rem .95rem; border: 1px dashed #b5b5b0; border-radius: 8px;
  background: #fafaf9; font-size: .9rem; font-weight: 500; cursor: pointer;
}
.file-btn:hover { border-color: #2d6cdf; color: #2d6cdf; background: #f4f8ff; }
.file-btn input { display: none; }
.file-btn .icon {
  width: 1.1em; height: 1.1em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.camera-btn { display: none; }
@media (pointer: coarse) { .camera-btn { display: inline-flex; } }
.file-list { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.file-list li {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem;
  background: #f4f4f2; border: 1px solid #e3e3e0; border-radius: 6px;
  font-size: .85rem; font-weight: 400;
}
.file-list .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fsize { flex-shrink: 0; color: #6e6e73; }
button.file-remove {
  width: auto; padding: 0 .25rem; background: none; border: 0;
  color: #b3261e; font-size: 1.05rem; line-height: 1; cursor: pointer;
}
.typeahead { position: relative; }
.ta-results {
  position: absolute; z-index: 5; left: 0; right: 0; margin: .2rem 0 0; padding: .25rem 0;
  list-style: none; background: #fff; border: 1px solid #c9c9c5; border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto;
}
.ta-results li {
  display: flex; justify-content: space-between; align-items: baseline; gap: .6rem;
  padding: .55rem .7rem; font-weight: 400; cursor: pointer;
}
.ta-results li.active, .ta-results li:hover { background: #f4f8ff; }
.ta-results .ta-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-results .ta-city { flex-shrink: 0; color: #6e6e73; font-size: .82rem; }
.ta-results .ta-note { color: #6e6e73; cursor: default; }
.ta-results .ta-free { color: #2d6cdf; font-style: italic; }
.parts-list { margin: 0 0 .5rem; }
.qty { display: inline-flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.qty button {
  width: 1.7rem; height: 1.7rem; padding: 0; line-height: 1;
  background: #fff; color: #1d1d1f; border: 1px solid #c9c9c5; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.qty button:hover { border-color: #2d6cdf; color: #2d6cdf; }
.qty input[type=number] {
  width: 3.2rem; margin: 0; padding: .25rem .2rem; text-align: center; -moz-appearance: textfield;
}
.qty input[type=number]::-webkit-outer-spin-button, .qty input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ta-selected {
  display: flex; align-items: center; gap: .5rem; margin-top: .3rem; padding: .5rem .6rem;
  background: #f4f4f2; border: 1px solid #e3e3e0; border-radius: 6px; font-weight: 400;
}
.ta-selected .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp { position: absolute; left: -9999px; height: 0; opacity: 0; }
.error { background: #fdecea; color: #b3261e; border-radius: 6px; padding: .7rem .9rem; margin-bottom: 1rem; font-size: .9rem; white-space: pre-line; }
.field-error { color: #b3261e; font-size: .8rem; font-weight: 400; margin-top: .2rem; }
button { width: 100%; padding: .8rem; font: inherit; font-weight: 600; color: #fff; background: #2d6cdf; border: 0; border-radius: 8px; cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
#success { text-align: center; padding: 2rem 0; }
@media (max-width: 480px) { .card { margin: 0; border-radius: 0; min-height: 100vh; } }
