:root {
  --bg: #FDF8F3;
  --surface: #FFFFFF;
  --primary: #F97316;
  --primary-light: #FFF7ED;
  --accent: #34D399;
  --accent-light: #ECFDF5;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --border: #F3E8DC;
  --shadow: 0 4px 20px rgba(31, 41, 55, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  padding: 20px 16px 120px;
  position: relative;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.header h1 {
  font-family: 'ZCOOL KuaiLe', cursive;
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 4px;
}

.header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.courier-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--primary);
  min-height: 40px;
}

.courier-hint .emoji {
  font-size: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #FB923C, var(--primary));
  color: #fff;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}

.btn-primary:hover {
  opacity: 0.95;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  font-weight: 500;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 15px;
}

.package-actions-row {
  display: flex;
  gap: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.package-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.package-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  animation: slideIn 0.35s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.package-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.package-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.package-emoji {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--primary-light);
  border-radius: 50%;
}

.package-title {
  font-size: 15px;
  font-weight: 600;
}

.package-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.package-number {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 8px 0;
  word-break: break-all;
}

.package-remark {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.package-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s;
}

.status-btn.pending {
  background: var(--accent-light);
  color: #059669;
}

.status-btn.picked {
  background: #E5E7EB;
  color: #6B7280;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state .emoji {
  font-size: 56px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}

.fab {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 50;
}

.fab .btn {
  padding: 14px 22px;
  font-size: 15px;
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 100;
  display: none;
  flex-direction: column;
}

.scanner-overlay.active {
  display: flex;
}

.edit-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: flex-end;
}

.edit-modal.active {
  display: flex;
}

.edit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.edit-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px 32px;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.edit-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.edit-body {
  margin-bottom: 16px;
}

.edit-footer .btn {
  width: 100%;
}

.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  color: #fff;
}

.scanner-header h3 {
  font-size: 16px;
  font-weight: 500;
}

.scanner-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#scanner-target {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

#scanner-target video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.scanner-footer {
  padding: 20px 16px 32px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.scanner-result {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: none;
}

.scanner-result.success {
  display: block;
  background: rgba(52, 211, 153, 0.18);
  color: #6EE7B7;
}

.scanner-result.error {
  display: block;
  background: rgba(239, 68, 68, 0.18);
  color: #FCA5A5;
}

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  z-index: 200;
  padding: 12px 20px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: #059669;
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 360px) {
  .header h1 {
    font-size: 26px;
  }

  .stat-value {
    font-size: 18px;
  }
}
