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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

header {
  background: #1a56db;
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
header h1 { font-size: 18px; font-weight: 600; }
header span { font-size: 13px; opacity: .75; }

.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 24px;
}
.tab-btn {
  padding: 14px 20px;
  border: none;
  background: none;
  font-size: 14px;
  cursor: pointer;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: all .2s;
}
.tab-btn.active {
  color: #1a56db;
  border-bottom-color: #1a56db;
  font-weight: 600;
}
.tab-btn:hover:not(.active) { color: #374151; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.container { max-width: 900px; margin: 0 auto; padding: 24px; }

.card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #111;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f3f4f6;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: 13px; font-weight: 500; color: #374151; }

input[type="text"], input[type="number"], select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #111;
  transition: border-color .2s;
  background: #fff;
}
input:focus, select:focus {
  outline: none;
  border-color: #1a56db;
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}

.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  transition: all .2s;
  user-select: none;
}
.radio-label input { display: none; }
.radio-label.selected {
  border-color: #1a56db;
  background: #eff6ff;
  color: #1a56db;
  font-weight: 500;
}

.dims-row { display: flex; align-items: center; gap: 8px; }
.dims-row input { flex: 1; }
.dims-sep { color: #9ca3af; font-size: 18px; }

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.btn-primary { background: #1a56db; color: #fff; }
.btn-primary:hover { background: #1648c4; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.result-box {
  display: none;
  margin-top: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.result-box.show { display: block; }

.result-header {
  background: #f8fafc;
  padding: 12px 18px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-header .tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.tag-L { background: #f3e8ff; color: #6b21a8; }
.tag-A { background: #d1fae5; color: #065f46; }
.tag-B { background: #dbeafe; color: #1e40af; }
.tag-C { background: #fef3c7; color: #92400e; }
.tag-D { background: #fee2e2; color: #991b1b; }

.result-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.result-card {
  padding: 20px 24px;
  border-right: 1px solid #e5e7eb;
}
.result-card:last-child { border-right: none; }
.result-card-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.result-price {
  font-size: 28px;
  font-weight: 700;
  color: #1a56db;
  margin-bottom: 8px;
}
.result-price .currency { font-size: 16px; }
.result-detail { font-size: 12px; color: #6b7280; line-height: 1.6; }

.result-info {
  padding: 12px 18px;
  border-top: 1px solid #e5e7eb;
  font-size: 13px;
  color: #6b7280;
  display: flex;
  gap: 20px;
}
.result-info span { display: flex; align-items: center; gap: 4px; }
.info-key { color: #374151; font-weight: 500; }

/* City search */
.city-search-wrap { position: relative; }
.city-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  display: none;
}
.city-dropdown.show { display: block; }
.city-option {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.city-option:hover { background: #f3f4f6; }
.city-tier-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

/* Price manager table */
.price-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.price-table th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid #e5e7eb;
}
.price-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.price-table tr:last-child td { border-bottom: none; }
.price-table tr:hover td { background: #fafafa; }

.combo-badge {
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 4px;
}
.price-input {
  width: 110px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  font-size: 13px;
  text-align: right;
}
.price-input:focus {
  outline: none;
  border-color: #1a56db;
  box-shadow: 0 0 0 2px rgba(26,86,219,.1);
}

.save-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
  margin-top: 8px;
}
.save-msg {
  font-size: 13px;
  color: #059669;
  opacity: 0;
  transition: opacity .3s;
}
.save-msg.show { opacity: 1; }

/* City list */
.tier-section { margin-bottom: 20px; }
.tier-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.tier-title { font-size: 15px; font-weight: 600; }
.tier-count { font-size: 12px; color: #9ca3af; }
.city-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.city-chip {
  background: #f3f4f6;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: #374151;
}

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warn { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

/* Monthly quote */
.city-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}
.city-row:last-child { border-bottom: none; }
.city-row .city-search-wrap { flex: 1; min-width: 140px; }
.city-row select { width: 110px; }
.city-row .pct-input { width: 80px; text-align: right; }
.city-row .remove-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
}
.add-city-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  padding: 8px 16px;
  color: #6b7280;
  cursor: pointer;
  font-size: 13px;
  margin-top: 8px;
  transition: all .2s;
  width: 100%;
  justify-content: center;
}
.add-city-btn:hover { border-color: #1a56db; color: #1a56db; }

.pct-total {
  font-size: 13px;
  padding: 8px 0;
  color: #6b7280;
}
.pct-total.ok { color: #059669; font-weight: 600; }
.pct-total.err { color: #dc2626; font-weight: 600; }

.monthly-result-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.monthly-result-table th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid #e5e7eb;
}
.monthly-result-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.monthly-result-table tr:last-child td { border-bottom: none; }
.monthly-result-table tr:hover td { background: #fafafa; }
.monthly-result-table .total-row td {
  background: #f0fdf4;
  font-weight: 600;
  border-top: 2px solid #d1fae5;
}
.price-cell { font-weight: 600; color: #1a56db; }
.sub-text { font-size: 12px; color: #9ca3af; margin-top: 2px; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .result-cards { grid-template-columns: 1fr; }
  .result-card { border-right: none; border-bottom: 1px solid #e5e7eb; }
}
