* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #f4f5f7;
  color: #202124;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: #f4f5f7;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 46px;
  line-height: 46px;
  background: #1677ff;
  color: #fff;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.nav-back {
  position: absolute;
  left: 8px;
  top: 0;
  width: 44px;
  height: 46px;
  background: transparent;
  color: #fff;
  font-size: 22px;
}

.search-wrap {
  padding: 12px 15px;
  background: #fff;
  border-bottom: 1px solid #edf0f5;
}

.search-grid {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 10px;
}

.search-grid select,
.search-grid input {
  height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.search-grid select {
  width: 100%;
  padding: 0 8px;
}

.search-grid input {
  min-width: 0;
  padding: 0 14px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.list {
  padding: 10px 15px 24px;
}

.item-card,
.info-card,
.line-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

.item-card {
  padding: 14px;
  margin-bottom: 10px;
}

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.item-no {
  color: #1677ff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-all;
}

.item-card p,
.info-card p,
.line-card p {
  font-size: 14px;
  line-height: 1.75;
  color: #333;
}

.item-card p span,
.info-card p span,
.line-card p span {
  color: #1677ff;
  font-weight: 500;
}

.meta-row {
  display: flex;
  gap: 10px;
  color: #666;
  font-size: 12px;
  margin-top: 8px;
}

.status-tag,
.line-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.status-unfinish {
  background: #ff7d00;
}

.status-finish {
  background: #00a870;
}

.empty,
.loading,
.error {
  padding: 24px 10px;
  color: #8a8f99;
  text-align: center;
  font-size: 14px;
}

.error {
  color: #d93026;
}

.detail-content {
  padding: 15px 15px 28px;
}

.info-card {
  padding: 15px;
  margin-bottom: 14px;
}

.section-title {
  margin: 14px 0 8px;
  font-size: 15px;
  font-weight: 650;
  color: #222;
}

.photo-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 2px 0 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
}

.photo-toolbar.hidden {
  display: none;
}

.photo-toolbar span {
  flex: 1;
  min-width: 0;
  color: #4b5563;
  font-size: 13px;
}

.photo-toolbar button {
  height: 30px;
  padding: 0 10px;
  border-radius: 5px;
  background: #edf2f7;
  color: #374151;
  font-size: 13px;
}

.photo-toolbar .primary-action {
  background: #1677ff;
  color: #fff;
}

.photo-toolbar button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.line-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.line-card {
  padding: 12px;
}

.line-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.line-title {
  font-size: 14px;
  font-weight: 650;
  color: #222;
  line-height: 1.45;
}

.line-status {
  background: #5f6f89;
}

.photo-scroll {
  display: flex;
  min-height: 174px;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.photo-scroll::-webkit-scrollbar {
  height: 4px;
}

.photo-scroll::-webkit-scrollbar-thumb {
  background: #c8ced8;
  border-radius: 2px;
}

.photo-item {
  position: relative;
  flex: 0 0 240px;
  height: 170px;
  overflow: hidden;
  border-radius: 8px;
  border: 2px solid transparent;
  background: #e9edf3;
  scroll-snap-align: start;
}

.photo-item.selected {
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, .14);
}

.photo-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  text-align: left;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-check {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
}

.photo-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.photo-check span {
  position: relative;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background: rgba(17, 24, 39, .42);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

.photo-check input:checked + span {
  border-color: #fff;
  background: #1677ff;
}

.photo-check input:checked + span::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 7px;
  height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.photo-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 7px 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .58));
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .86);
}

.photo-viewer.active {
  display: flex;
}

.photo-viewer img {
  max-width: 96vw;
  max-height: 88vh;
  object-fit: contain;
}

.viewer-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 28px;
  line-height: 40px;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  width: 42px;
  height: 54px;
  margin-top: -27px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 42px;
  line-height: 48px;
}

.viewer-nav:disabled {
  display: none;
}

.viewer-prev {
  left: 10px;
}

.viewer-next {
  right: 10px;
}

.viewer-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  font-size: 14px;
}

.viewer-bar span {
  min-width: 52px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.viewer-bar button {
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 120;
  max-width: min(320px, calc(100vw - 32px));
  padding: 9px 14px;
  border-radius: 18px;
  background: rgba(17, 24, 39, .9);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .18s ease, transform .18s ease;
}

.toast.active {
  opacity: 1;
  transform: translate(-50%, 0);
}
