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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  line-height: 1.5;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.subtitle {
  text-align: center;
  color: #86868b;
  font-size: 14px;
  margin-bottom: 24px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1d1d1f;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  color: #86868b;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #0071e3;
}

.form-group input::placeholder {
  color: #c7c7cc;
}

/* 가로 배치 */
.form-row {
  display: flex;
  gap: 10px;
}

.form-row .flex-2 {
  flex: 2;
}

.form-row .flex-1 {
  flex: 1;
}

/* select */
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386868b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-group select:focus {
  border-color: #0071e3;
}

.hint {
  display: block;
  font-size: 12px;
  color: #0071e3;
  margin-top: 4px;
}

/* 조제료 유형 버튼 */
.fee-type-buttons {
  display: flex;
  gap: 8px;
}

.fee-type-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.fee-type-btn.active {
  background: #0071e3;
  color: #fff;
  border-color: #0071e3;
}

.fee-type-btn:hover:not(.active) {
  background: #f5f5f7;
}

/* 배수 버튼 */
.multiplier-buttons {
  display: flex;
  gap: 8px;
}

/* OTC 마진율 버튼 */
.otc-margin-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.otc-margin-btn.active {
  background: #0071e3;
  color: #fff;
  border-color: #0071e3;
}

.otc-margin-btn:hover:not(.active) {
  background: #f5f5f7;
}

.multiplier-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.multiplier-btn.active {
  background: #0071e3;
  color: #fff;
  border-color: #0071e3;
}

.multiplier-btn:hover:not(.active) {
  background: #f5f5f7;
}

.divider {
  height: 1px;
  background: #e5e5ea;
  margin: 16px 0;
}

/* 결과 카드 */
.result-card {
  background: #1d1d1f;
  color: #f5f5f7;
}

.result-card h2 {
  color: #f5f5f7;
}

.result-section {
  margin-bottom: 20px;
}

.result-section:last-child {
  margin-bottom: 0;
}

.result-section h3 {
  font-size: 13px;
  color: #86868b;
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 15px;
}

.result-row .highlight {
  font-weight: 600;
  color: #30d158;
}

.result-row.big {
  padding: 12px 0 4px;
  font-size: 18px;
  font-weight: 700;
  border-top: 1px solid #333;
  margin-top: 8px;
}

.result-row.big span:last-child {
  color: #0a84ff;
  font-size: 22px;
}

/* 마이너스일 때 */
.negative {
  color: #ff453a !important;
}

/* 토글 */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0071e3;
}

.tax-result {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e5ea;
}

.result-row-light {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 14px;
}

.highlight-blue {
  font-weight: 600;
  color: #0071e3;
}

/* 시뮬레이션 */
.sim-desc {
  font-size: 13px;
  color: #86868b;
  margin-bottom: 12px;
}

.sim-config {
  margin-bottom: 12px;
}

.sim-table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
}

.sim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sim-table th {
  background: #f5f5f7;
  padding: 8px 6px;
  text-align: right;
  font-weight: 600;
  color: #86868b;
  font-size: 12px;
  border-bottom: 2px solid #d2d2d7;
  white-space: nowrap;
}

.sim-table th:first-child {
  text-align: left;
}

.sim-table td {
  padding: 7px 6px;
  text-align: right;
  border-bottom: 1px solid #e5e5ea;
  white-space: nowrap;
}

.sim-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.sim-table tr.optimal {
  background: #e8f5e9;
}

.sim-table tr.optimal td {
  font-weight: 600;
  color: #1b5e20;
}

.sim-table tr.step-up {
  border-top: 2px solid #ff9800;
}

.sim-table tr.negative td:nth-child(3),
.sim-table tr.negative td:nth-child(4) {
  color: #ff453a;
}

.sim-optimal {
  margin-top: 12px;
  padding: 12px;
  background: #e8f5e9;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #1b5e20;
  text-align: center;
  display: none;
}

/* 반응형 */
@media (min-width: 600px) {
  .container {
    padding-top: 40px;
  }

  h1 {
    font-size: 28px;
  }
}
